不确定是否有其他人在使用Facebook-PHP-SDK v5时遇到过类似的问题。检索用户配置文件项目,如名称,名字,姓氏等。我有以下电话。无法从Facebook用户检索位置
public function getProfile(){
try {
$profile_request = $this->fb->get('/me?fields=name,first_name,last_name,email,gender,relationship_status, birthday, location');
$profile = $profile_request->getGraphNode()->asArray();
return $profile;
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
session_destroy();
// redirecting user back to app login page
header("Location: ./");
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
这是被称为我的index.php页面如下:
$profile = $fblink->getProfile();
print_r($profile);
现在奇怪的,这是所有的用户数据都被打印除用户的位置。我已经在我的应用中检查了我的权限,并且已启用Users_location。我没有收到任何类型的错误,所以我似乎无法找到为什么这不会被返回的原因。
如果有人知道一个简单的解决方法来返回位置,这将有很大的帮助。或者如果有人能够说明为什么地点不归还,这将同样有帮助。谢谢