我想從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