我想从Facebook API检索Facebook用户名,但我收到错误。如何从graphobject检索facebook用户名?
我曾尝试下面的代码
$request = new FacebookRequest($session, 'GET', '/me');
$response = $request->execute();
echo $user=$response->getName();
代码激励我,以获取来自Facebook的用户名和运行succesfull。 当我在浏览器中的数据显示执行喜欢这样显示这个
$graphObject = $response->getGraphObject();
echo = $graphObject;
数据我知道作为GraphObject Facebook的\ GraphObject对象
(
[backingData:protected] => Array
(
[id] => 54665634
[first_name] => somePerson
[gender] => male
[last_name] => SomePerson
[link] => https://www.facebook.com/app_scoped_user_id/983427658473566/
[locale] => id_ID
[name] => SomePerson
[timezone] => 7
[updated_time] => 2015-05-13T14:47:40+0000
[verified] => 1
)
)
这是我的问题
Fatal error: Call to undefined method Facebook\FacebookResponse::getName() in C:\xampp\htdocs\hacking\fbtest.php on line 39
所以如何我能解决吗?
我刚刚知道graphObject使用facebook API后,什么数据类型graphObject? ,我可以在那里学习。我的意思是它只是关于facebook API,不像章节,数组,json在php中。 – Alimin
你是什么意思?我不明白你。关于graphobject的更多信息可以在这里找到:https://developers.facebook.com/docs/php/GraphObject/4.0.0 – krzysiej
我的意思是,你知道php中有很多章节,例如variabel和程序,面向对象编程等 facebook API位于哪里? – Alimin