如果我在 Facebook Graph Explorer 中输入以下查询,则都返回一个值的结果:
Case 1)
SELECT user_id from like where object_id =584xxxxxxx637
{
"data": [
{
"user_id": 100xxxxxxxxxxx57
}
]
}
in PHP code:
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT user_id from like where object_id=584xxxxxxx637'));
var_dump($result);
returns the expected result:
array(1) { [0]=> array(1) { ["user_id"]=> string(15) "100xxxxxxxxxxx57" } }
但是,对于以下类似查询,我也从图形资源管理器中获得了有效结果,但从 PHP 中却没有:
Case 2)
SELECT page_id from page_fan where uid=me() and page_id=400xxxxxxxx095
Result in Graph Explorer:
{
"data": [
{
"page_id": 400xxxxxxxx095
}
]
}
in PHP
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT page_id from page_fan where uid=me() and page_id=400xxxxxxxx095'));
var_dump($result);
Output:
array(0) { }
用户登录 Facebook 进行会话(因此图形查询返回有效结果)
我不知道为什么!