谁能告诉我,可标记朋友的ID本质上是动态的吗?我为什么这么说是,每次当我运行程序收集我的Facebook可标记朋友时,
每次使用get('/me/taggable_friends?fields=name&limit=100')
在运行以下代码两次时,我得到了不同的 id [就像 id 集附在这里一样 set-1 http://pastebin.com/fjUmCgJY 和 set-2 http://pastebin.com/RpTZswc6 用于同一组可标记的朋友]。
if ($fb->next($friends)) {
$allFriends = array();
$friendsArray = $friends->asArray();
$allFriends = array_merge($friendsArray, $allFriends);
while ($friends = $fb->next($friends)) {
$friendsArray = $friends->asArray();
$allFriends = array_merge($friendsArray, $allFriends);
}
$array1 = json_encode($allFriends, true);
//foreach ($allFriends as $key) {
//echo $key['name'] . "<br>";
//}
echo ($array1);
//echo count($allFriends);
} else {
$allFriends = $friends->asArray();
$totalFriends = count($allFriends);
$array1 = json_encode($allFriends, true);
/*foreach ($allFriends as $key) {
echo $key['name'] . "<br>";
}*/
echo ($array1);
}
另一个观察结果是,在执行我的代码时,有时我得到结果,但有时我得到
Fatal error: Call to a member function bind_param() on boolean in
原因是什么?
您只能获得带有taggable_friends
的"标记令牌",无法获取用户 ID。您只能使用taggable_friends
进行标记,因此无论如何都不需要获取用户 ID。
如果您想访问其他朋友,我建议您阅读此线程中的答案:Facebook Graph API v2.0+ -/me/friends 返回空,或者仅返回也使用我的应用程序的朋友