开发者

Facebook PHP 3.0.1 SDK API, getUser() always == 0! Why?

I have the following code:

$facebook = new Facebook(array(
    'appId' => '###',
    'secret' => '###'
));
$user = $facebook->getUser();

$user is ALWAYS 0, my AppId and Secret are both 100% correct. 开发者_开发百科What am I doing wrong?


make sure that you have an if condition to check for user status

$user=$facebook->getUser();
if($user)
//someactions
else
{
// redirect the user to login and authorize your application, if necessary
header('Location:'.$facebook->getLoginURL());
}

Please check the case of functions. I may be wrong.


Just chek in your facebook Your FB Application Admin Panel if you put the right website url... LOCALHOST for testing purpose or your http://www.YOURWEBSITE.com


I had the same problem once... And I just managed to solve it by correcting the problem with my session

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜