put() public method

添加分享
public put ( integer $uid, string $app = 'public', string $type = '', array $data = [], integer $app_id, string $app_table = 'feed', array $extUid = null, array $lessUids = null, boolean $isAtMe = true, $is_repost ) : mix
$uid integer 操作用户ID
$app string 分享应用类型,默认为public
$type string 分享类型,
$data array 分享相关数据
$app_id integer 应用资源ID,默认为0
$app_table string 应用资源表名,默认为feed
$extUid array 额外用户ID,默认为null
$lessUids array 去除的用户ID,默认为null
$isAtMe boolean 是否为进行发送,默认为true
return mix 添加失败返回false,成功返回新的分享ID
<?php

// ....
require_once 'config.php';
require_once 'FeedModel.php';
DatastoreService::setInstance(new DatastoreService($google_api_config));
$feed_url = 'http://www.sciam.com/xml/sciam.xml';
$feed_model = new FeedModel($feed_url);
// save the instance to the datastore
$feed_model->put();
// now, try fetching the saved model from the datastore
$kname = sha1($feed_url);
// fetch the feed with that key, as part of the transaction
$feed_model_fetched = FeedModel::fetch_by_name($kname)[0];
echo "fetched feed model with subscriber url: " . $feed_model_fetched->getSubscriberUrl();