$queries = array(
array('method' => 'GET', 'relative_url' => '/'.$user),
array('method' => 'GET', 'relative_url' => '/'.$user.'/home?limit=50'),
array('method' => 'GET', 'relative_url' => '/'.$user.'/friends'),
array('method' => 'GET', 'relative_url' => '/'.$user.'/photos?limit=6'),
);
// POST your queries to the batch endpoint on the graph.
try{
$batchResponse = $facebook->api('?batch='.json_encode($queries), 'POST');
}catch(Exception $o){
error_log($o);
}
//Return values are indexed in order of the original array, content is in ['body'] as a JSON
//string. Decode for use as a PHP array.
$user_info = json_decode($batchResponse[0]['body'], TRUE);
$feed = json_decode($batchResponse[1]['body'], TRUE);
$friends_list = json_decode($batchResponse[2]['body'], TRUE);
我已編輯的代碼是後,我已經編輯我的PHP代碼,它不能正常工作
$queries = array('method' => 'GET', 'relative_url' => '/'.$user);
try{
$batchResponse = $facebook->api('?batch='.json_encode($queries), 'POST');
}catch(Exception $o){
error_log($o);
}
$user_info = json_decode($batchResponse['body'], TRUE);
但它不能正常工作了,當我回聲沒有價值$ USER_INFO
我做了什麼錯?
昏迷「無法正常工作不再「 - 根本沒有幫助 – KevinDTimm
錯誤是什麼由FB API調用返回? – jamis0n
如果確實有效並且現在不行,請撤消更改。 – GolezTrol