如何订购从新的Facebook Graph API返回的朋友列表? [英] How do I order the friends list returned from the new Facebook Graph API?

查看:68
本文介绍了如何订购从新的Facebook Graph API返回的朋友列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以通过以下方式获取经过身份验证的用户的朋友列表:

You can get a list of friends of an authenticated user with:

https://graph.facebook.com/me/friends

任何人都不知道如何按用户名排序列表吗?因为默认情况下不是.文档中没有任何内容.

Anyone have any idea how to order the list by user name? Because it doesn't by default. There's nothing in the documentation.

推荐答案

提出了解决方案.最终,我们可能能够订购图形结果.现在,我只是这样做(javascript).假设我从PHP会话中获得了"fb_uid":

Figured out a solution. Eventually, we'll probably be able to order graph results. For now, I'm just doing this (javascript). Assuming that I got "fb_uid" from my PHP session:

var friends = FB.Data.query("SELECT name, uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1={0}) ORDER BY name", parseInt(fb_uid));
friends.wait(function(rows){
    console.log(rows);
});

这篇关于如何订购从新的Facebook Graph API返回的朋友列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆