所以我用php facebook sdk做了一个网络应用程序并在我的本地主机上运行它......一切似乎都很好,函数GetUser让我获得了用户ID......然后当我将网络上传到主机服务器GetUser()总是返回 0... 有人知道吗?
这是我的代码,没什么特别的:
$homeurl = 'http://postmaster.net78.net/MainMenu.php'; //return to home
$fbPermissions = 'user_events,friends_events,read_stream,publish_stream,offline_access';
$facebook = new Facebook(array(
'appId' => '****',
'secret' => '***',
));
$user = $facebook->getUser();
echo $user;
if ($user)
{
.......
}
else
{
$_fb['loginurl'] = $facebook->getLoginUrl(array('redirect_uri'=>$homeurl,'scope' => $fbPermissions));
$_fb['authed'] = false;
echo '<center><br><br><br><br><br><br><br>For start working with <img src="images/logoBlack.gif" height = "8%" width="15%"> <br>you must connect to your facebook account<br>';
echo '<a href="'.$_fb['loginurl'].'"><img src="images/loginwithfacebook.jpg"></a>';
}
感谢帮手