简体   繁体   English

$ me = $ facebook-> api('/ me'); 返回空字符串

[英]$me = $facebook->api('/me'); returns empty string

This piece of code used to work as expected, but now it seems i can't retrieve the user name the same way: 这段代码曾经按预期工作,但是现在看来我无法以相同的方式检索用户名:

 $uid = $facebook->getUser(); // returns the facebook id of the user
 $me = $facebook->api('/me'); // returns empty. why?

Due some facebook api updates i had to change the getSession from: 由于一些Facebook API更新,我不得不将getSession从以下位置更改:

$session = $facebook->getUser();

to

$session = $facebook->getUser()>0;

So how to retrieve the user name in facebook? 那么如何在Facebook中检索用户名?

So how to retrieve the user name in facebook? 那么如何在Facebook中检索用户名?

What about this : 那这个呢 :

$pageContent = file_get_contents('http://graph.facebook.com/USERID');
$parsedJson  = json_decode($pageContent);
echo $parsedJson->name;

Facebook使用CURL向服务器发送请求,可能您服务器上的curl无法正常工作或curl_exec已禁用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM