直到几个月前我才使用这种方法来获取用户的Facebook个人资料图片并且工作正常.
public function getUserProfilePic(){
$access_token = $this->facebook_obj->getAccessToken();
$user_id = $this->facebook_obj->getUser();
$response = $this->facebook_obj->api(
"/me/picture",
"GET",
array (
'redirect' => false,
'type' => 'large'
)
);
return (!empty($response['data']['url'])) ? $response['data']['url'] : 'images/default_profile.jpg';
}
Run Code Online (Sandbox Code Playgroud)
但是由于新的PHP SDK我对这个方法有一些问题.如果我在我的应用程序的主菜单上找了5分钟而不是点击进入它调用此方法的页面我得到
"OAuthException:必须使用活动访问令牌来查询有关当前用户的信息"错误.
有什么想法吗?