Facebook 应用程序自动刷新
我的应用程序自动刷新到 Facebook 登录网址,但我的用户已经登录,因此不断重复刷新。
这是我的代码
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'my secret key',
'cookie' => true,
));
$session = $facebook->getSession();
$fbme = null;
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'next' => 'my app uri',
'cancel_url' => 'my app uri',
'req_perms' => 'email,publish_stream,status_update,offline_access,user_birthday'
)
);
if (!$session) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
else {
try {
$uid = $facebook->getUser();
$fbme = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
}
function d($d){
return TRUE;
}
,我的页面刷新源是:
"<script type='text/javascript'>top.location.href = 'facebook login url..';</script>
始终刷新,不间断。
我查看了谷歌,发现了 p3p 政策: header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
添加但不起作用:(
抱歉我的英语不好。
My application refreshs automatically to facebook login url but my user already signed in so repeats refresh, nonstop.
Here is my code
$facebook = new Facebook(array(
'appId' => 'my app id',
'secret' => 'my secret key',
'cookie' => true,
));
$session = $facebook->getSession();
$fbme = null;
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'next' => 'my app uri',
'cancel_url' => 'my app uri',
'req_perms' => 'email,publish_stream,status_update,offline_access,user_birthday'
)
);
if (!$session) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
else {
try {
$uid = $facebook->getUser();
$fbme = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
}
function d($d){
return TRUE;
}
And my page's source in refresh is:
"<script type='text/javascript'>top.location.href = 'facebook login url..';</script>
Always refreshs, non stop.
I looked google and i found p3p policy: header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
added but not working :(
Sorry for my bad English.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想你需要看看这个文档:
I guess you need to look at this document:
您可能正在使用旧版本的 PHP Sdk。
You might be using the old version of the PHP Sdk.