我正在使用以下代码脚本,并且页面由于没有获取用户 ID 而陷入无限循环。请帮我。
<?php
include_once("facebook.php");
# Creating the facebook object
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxx',
'cookie' => true
));
$user = $facebook->getUser();
if($user) {
try{
$user = $facebook->api('/me');
} catch (Exception $e){}
if(!empty($user)){
print_r($user);
}
else {
die("There was an error.");
}
}
else {
$login_url = $facebook->getLoginUrl(array('scope'=>$fbPermissions,'redirect_uri'=>'http://www.mysit.com.com/script/check.php'));
header("Location: ".$login_url);
}
?>