开发者

How to show a random friend with profile picture who uses my application

i want to show a random friend to user who uses my application.I have开发者_Python百科 neccesarry permission to get all friends but can't show random friend(s)

Can you give me a code for this please.

Thanks


You can pull back a JSON of fbuids of each friend, JSON decode it, then use array_rand to pull out a random one


$friends = array("Mitch", "Dave", "Charlie", "Tom"); 
$rand_keys = array_rand($friends, 1);
echo $friends[$rand_keys[0]] . "\n"; 
echo $friends[$rand_keys[1]] . "\n"; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜