作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
基于 this question ,有没有办法检查用户是否已使用基于 PHP 的 Facebook SDK 向应用程序授予了一组特定的权限?我浏览了 API,但找不到任何内容。
最佳答案
$permissions = $facebook->api("/me/permissions");
然后使用 if 来检查你需要哪个权限
例如:
if (array_key_exists('publish_stream', $permissions['data'][0])) {
postToWall();
} else {
//Does not have permission
}
如果您正在使用 FQL
$perms = $facebook->api(array(
"method" => "fql.query",
"query" => "SELECT read_stream,offline_access,publish_stream FROM permissions WHERE uid=me()"
));
echo "<ul>";
foreach ($perms[0] as $k => $v) {
echo "<li>";
if ($v === "1") {
echo "<strong>$k</strong> permission is granted.";
} else {
echo "<strong>$k</strong> permission is not granted.";
}
echo "</li>";
}
http://www.masteringapi.com/tutorials/how-to-check-if-user-has-certian-permission-facebook-api/22/
关于php - 如何检查用户是否已授予我的 PHP 应用程序一组特定权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8478246/
我是一名优秀的程序员,十分优秀!