Facebook PHP SDK:API(';/me&)行为奇怪 [英] Facebook PHP SDK: api('/me') strange behavior
本文介绍了Facebook PHP SDK:API(';/me&)行为奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谢谢!:)
try {
$user_profile = $facebook->api('/me');
$scope = 'publish_stream,user_photos';
$scope_params = explode(',',$scope);
$permissions = $facebook->api("/me/permissions");
if( array_key_exists('publish_stream', $permissions['data'][0]) && array_key_exists('user_photos', $permissions['data'][0])) {
// facebook logic
}else {
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Redirect</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script language=javascript>window.open('<?php echo $loginUrl ?>', '_parent', '')</script>
</head>
<body>
Redirecting...
</body>
</html>
<?php
exit;
}
}catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
}
推荐答案
解决方案是将所有代码放入一个index.php文件
这篇关于Facebook PHP SDK:API(';/me&)行为奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文