getUser方法在mozilla中第一次访问时返回0,但在chrome中工作良好


getUser method returns 0 when first time accessed in mozilla but works fine in chrome

我使用以下代码来检查用户是否在FB登录,然后相应地重定向到我的网站页面。

include_once "./fbsrc/facebook.php";
$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true,
));
$uid = $facebook->getUser();

我把上面的代码放到一个文件中。我用这个文件获取用户id如果得到id,则重定向用户到page1.php如果没有,则重定向到page2.php,如下

include "fbmain.php";
if(isset($uid) && !empty($uid))
{
    //redirect to page1.php  
}
else
{
    //redirect to page2.php
}

此代码在google chrome中工作良好,但在mozilla中会出现问题。在mozilla每次用户被重定向到page2.php,即使用户登录FB作为$uid没有设置。我得到int(0)当var_dump($uid)。代码有什么问题?请帮帮我。

谢谢…

您是否禁用了Firefox中的cookie ?

相关文章: