json api图调用不返回任何东西? [英] json api graph call does not return anything?
问题描述
我正在获取用户fb newfeed,我想得到检查wether用户喜欢的帖子或不使用user_likes,问题是以下代码不会返回任何东西:
i am fetching users fb newfeed and i wanted get check wether user has liked the post or not by using user_likes and the problem is that the following code wont return anything :
$getlike = $facebook->api("/fql?q=SELECT like_info FROM stream WHERE post_id=" . $id);
$checklike = $getlike['data'][0]['like_info']['user_likes'];
这是完整的文件: testone.php
的问题是,fql和调用user_likes不会返回任何东西。
i想检查wether用户已经喜欢的帖子已经 OR 如何获取user_likes的值。
here is the complete file: testone.php the problem is that the fql and calling user_likes wont return anything. i want to check wether user has liked the post already OR how can i get the value for user_likes.
从fb的JSON:
JSON from fb :
{
"data": [
{
"like_info": {
"can_like": true,
"like_count": 70,
"user_likes": false
}
}
]
}
我的技术是否正确?我需要访问代码吗?
is my technique right?do i need access code or something?
推荐答案
如果您获得 $ getlike
的值,则可以检查 user_likes的值
这样(因为它是类型boolean) -
If you are getting the value of $getlike
, you can check the value of user_likes
like this (since it is of type boolean)-
if($getlike['data'][0]['like_info']['user_likes'])
{
echo "true";
}
else
{
echo "false";
}
这篇关于json api图调用不返回任何东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!