本文整理汇总了PHP中SaeTClientV2::request_with_uid方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::request_with_uid方法的具体用法?PHP SaeTClientV2::request_with_uid怎么用?PHP SaeTClientV2::request_with_uid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeTClientV2
的用法示例。
在下文中一共展示了SaeTClientV2::request_with_uid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addWeiboUserInfo
public static function addWeiboUserInfo($user_id)
{
//微博是否已返回相应的信息
// $token = LuS::get()
if (isset($_SESSION['token']) && !empty($_SESSION['token'])) {
$data['uid'] = $_SESSION['token']['uid'];
$data['user_id'] = $user_id;
$db = self::_db();
$result_select_weibo = $db->where(array("uid" => $_SESSION['token']['uid']))->select();
//如果微博用户没有存在
if (!$result_select_weibo) {
if (!self::$_config) {
self::$_config = (require_once WEIBO_PATH . 'config/config.php');
}
$c = new SaeTClientV2(self::$_config['WB_AKEY'], self::$_config['WB_SKEY'], self::$_config['WB_ACCESS_TOKEN']);
$info = $c->request_with_uid('https://api.weibo.com/2/users/show.json', $_SESSION['token']['uid']);
//取出相应的微博用户信息
// $info = json_decode( $info, true );
if (isset($info['screen_name']) && !empty($info['screen_name'])) {
$data['screen_name'] = $info['screen_name'];
$data['description'] = $info['description'];
$data['location'] = $info['location'];
$data['profile_image_url'] = $info['profile_image_url'];
}
$data['access_token'] = $_SESSION['token']['access_token'];
$data['expires_in'] = $_SESSION['token']['expires_in'];
//把微博用户信息存入weibo_userinfo表里
$data['uid'] = $_SESSION['token']['uid'];
return $db->data($data)->insert();
} else {
return true;
}
} else {
return false;
}
}