我正在尝试从facebook中检索。以下代码检索所有ID。但是我收到错误为foreach()提供的无效参数为行 foreach($ status ['喜欢''['data']为$ likesData)
$statuses = $facebook->api('/me/statuses');
foreach($statuses['data'] as $status){
foreach($status['likes']['data'] as $likesData){
$frid=$likesData['id'];
echo $frid;
echo "<br>";
}
}
答案 0 :(得分:0)
并非所有状态都喜欢(就像并非所有状态都有评论一样)所以您需要首先检查状态是否喜欢:
$statuses = $facebook->api('/me/statuses');
foreach($statuses['data'] as $status){
if(!empty($status['likes'])) {
foreach($status['likes']['data'] as $likesData){
$frid=$likesData['id'];
echo $frid;
echo "<br>";
}
}
}
显然你需要先检查一下你是否有任何状态!