有没有办法知道用户是否将图像上传到个人资料或通过 Facebook 的默认用户图片FQL或者是其他东西?
如果用户没有照片,那么当您请求指定了“照片”字段的用户对象时,is_silhouette 字段将为 true。
请求示例:
https://graph.facebook.com/username?fields=picture
回复:
{
"id": "100002095576350",
"picture": {
"data": {
"url": "http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif",
"is_silhouette": true
}
}
}
快速但肮脏的 PHP 函数:
function facebook_user_has_photo($username_or_id){
$request = file_get_contents('https://graph.facebook.com/'.$username_or_id.'?fields=picture');
if($request):
$user = json_decode($request);
if($user && !$user->picture->data->is_silhouette) return true;
endif;
return false;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)