使用 FQL 和 PHP sdk 获取点赞列表
我正在尝试获取用户在 Facebook 上喜欢的电视节目列表(它们之间用逗号分隔)。 下面的代码仅显示最后一个数组,但是如果我使用“print_r($fqlResults)”执行此操作,它将显示所有数组。
$fql = "SELECT name, type FROM page WHERE type IN ('TV SHOW') AND page_id IN (SELECT page_id FROM page_fan WHERE uid = me())";
$fqlResults = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));
foreach( $fqlResults as $keys => $values ){
$tvShows = $values[name];
}
任何回复将不胜感激:)
I'm trying to get a list of tv shows that a user has liked on Facebook (with a comma between them).
The code below only shows the last array, however if I do it using "print_r($fqlResults)" it shows all of the arrays.
$fql = "SELECT name, type FROM page WHERE type IN ('TV SHOW') AND page_id IN (SELECT page_id FROM page_fan WHERE uid = me())";
$fqlResults = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));
foreach( $fqlResults as $keys => $values ){
$tvShows = $values[name];
}
Any responses will be appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FQL 查询正确。但是你的 PHP 代码的 foreach 没有连接任何东西。
您应该使用 implode 函数
http://php.net/manual/en/function.implode .php
The FQL query is correct. But your PHP code's foreach is not concatenating anything.
You should use the implode function
http://php.net/manual/en/function.implode.php