【发布时间】:2015-02-17 10:36:09
【问题描述】:
我正在寻找检索所有使用同一应用程序(PHP SDK 4.)的朋友,带有 uid、用户名和分数
我的应用拥有此权限:
('email', 'user_about_me', 'user_friends', 'publish_actions', 'user_games_activity')
现在,我正在使用这个脚本,它只检索使用同一应用程序的用户的 uid:
$me = (new \Facebook\FacebookRequest($session, 'GET', '/me/friends'))->execute()->getGraphObject(\Facebook\GraphUser::className());
$result = $me->asArray();
// Get user's friends
$friends = $result['data'];
// Converting classes to array
foreach ($friends as $key => $value) {
$friends[$key] = (array)$value;
echo $friends[0]['id']; //show the id of the user 0
echo "|";
}
我在检查所有朋友时遇到问题,我尝试更改此脚本,但我无法获得所有朋友,但只有第一个... [0]
现在,我搜索了很多关于这个主题的...但我只找到旧的 SDK,使用新的,我应该怎么做才能检索同一个应用程序的 uid、用户名和分数?像这样:
echo $friends[0]['id']; //show the id of the user 0
echo "|";
echo $friends[0]['name']; //show the name of the user 0
echo "|";
echo $friends[0]['score']; //show the score of the user 0
echo "|";
[number_uid0] | [名称用户名0] | [得分0] | [number_uid1] | [名称用户名1] | [score1] 等等……
非常感谢 :)
【问题讨论】: