本文介绍了$ me = $ facebook-> api('/ me');返回空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这段代码用于预期工作,但现在看来我无法以相同的方式检索用户名:
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?
由于某些facebook api更新,我不得不更改getSession:
Due some facebook api updates i had to change the getSession from:
$session = $facebook->getUser();
至
$session = $facebook->getUser()>0;
那么如何在Facebook中检索用户名?
So how to retrieve the user name in facebook?
推荐答案
这是什么:
$pageContent = file_get_contents('http://graph.facebook.com/USERID');
$parsedJson = json_decode($pageContent);
echo $parsedJson->name;
这篇关于$ me = $ facebook-> api('/ me');返回空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!