开发者

Facebook: $facebook->getSession(); return null

HI,

开发者_开发知识库

I am new to FB development and just starting developing the app for blood donors site.

I have used the sample code provided on developers section, it worked and I started building. Later in the middle I decided to check the initial starting process again and created a dummy account which is totally fresh. Note: The new account have never added the app, its just the landing page issue.

Below Are the different results, just ran the print_r() on $session.

Ubuntu 10.04 FF 3.6.14: complete array of session.

Ubuntu 10.04 Chromium 9.0.597.107:null

Ubuntu Virtual Box, IE8: Null

Windows 7 FF Beta: null

I am not sure why there are different behaviors. Also I have tested windows 7 with an old account and it showed NULL


If $facebook->getSession() returns false, try redirecting the user to $fb->getLoginUrl() and get a new session. The browser shouldn't matter, only that you might have your Facebook cookies cached on FF3.6.

$session = $facebook->getSession();

if (!$session)
{
    header("Location: ".$facebook->getLoginUrl());
    exit;
}
else
{
    // do stuff
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜