我想从请求的api调用中选择一个特定的field.item并回显它。例如:
$getlike = $facebook->api("/fql?q=SELECT%20like_info%20FROM%20stream%20WHERE%20post_id=".$id);
$getcm = $getlike['data']['like_info']['user_likes'];
echo $getcm;
上述代码的JSON:
{
"data": [
{
"like_info": {
"can_like": true,
"like_count": 70,
"user_likes": false
}
}
]
}
当我回显$ getcm时,它不会返回任何东西。有什么不对吗?
答案 0 :(得分:0)
data
是一个数组;所以你应该像 -
$getcm = $getlike['data'][0]['like_info']['user_likes'];
echo $getcm;