<?php
function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$status_all = "https://api.facebook.com/method/fql.query?query=SELECT type, app_id, comments, post_id, actor_id, target_id, message, created_time FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1=me())&limit=50&format=json&access_token=XXXXXX";
$status_all = json_decode(curl($status_all));
if(count($status_all)>=0){
foreach($status_all as $status){
echo $status->type;
}
}
?>
但它返回:警告:在第 16 行的 file.php 中为 foreach() 提供的参数无效
知道为什么会这样吗?