我正面临一个基于 facebook 应用脚本的问题。它总是返回 0,即使用户登录到 facebook。我看了一下旧的讨论,但我找不到解决方案。请看一下代码。
<?php
require "config/database.class.php";
require 'fbook/src/facebook.php';
require "core/corefunction.php";
$facebook = new Facebook(array(
'appId' => 'xxxxxxx',
'secret' => 'xxxxxxxxx',
));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if ($user) {
echo "Yes";exit;
}
else{
$urlf= $facebook->getLoginUrl(array('scope' => 'user_status,publish_stream'));
?>
<script language="javascript" type="text/javascript">
document.location.href="<?php echo $urlf; ?>";
</script>
<?php
exit;
} ?>
在验证 facebook 后,我得到一个这样的 url,
http://www.example.com/fblog.php?state=91e3e7013fcfeb01df23eed352add987&code=AQAyitCNGSqtCEwMueFi5RvFILI0YC2P4IFdaY0TFK7_ay5vSU1RZh1Ab56DS6aUokQj9VS6RCoYTKmFa0H0AbUFsZBWZTLlFvWqVoOMpwZQcTeCoHcZ1o3NE2VljyoXgfJERreb2ZvL1MhwZ2rKSaInk9SMiyiaNrRXU86fkiL6GBbhrM1aCfuWPq7jqwqG_IM#_=_
它被连续调用...