/**
* 从Callback返回时
*/
public function callback()
{
if (isset($_REQUEST['code'])) {
$keys = array();
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = WB_CALLBACK_URL;
try {
$token = $this->sina->getAccessToken('code', $keys);
} catch (OAuthException $e) {
}
}
if ($token) {
$_SESSION['token'] = $token;
setcookie('weibojs_' . $this->sina->client_id, http_build_query($token));
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
$ms = $c->home_timeline();
// done
$uid_get = $c->get_uid();
$uid = $uid_get['uid'];
$user = $c->show_user_by_id($uid);
//根据ID获取用户等基本信息
$_SESSION['token']['name'] = $user['name'];
echo "\n\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\twindow.opener.callback_exec('Sina' , {$uid} , '{$user['name']}',false);\n\t\t\t\t\t\twindow.close();\n\t\t\t\t\t</script>";
} else {
echo '授权失败';
}
}