第一次在浏览器中登录 Facebook 时。我调用函数 getuser 进行检查,但我无法得到它,它只返回零。仅在我第一次打开浏览器时才发生。
$facebook = new Facebook(array(
'appId' => 'xxxxx',
'secret' => 'xxxxxxx',
'cookie' => true
));
$here = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$next = preg_replace('~#.*$~s', '', $here);
$next = preg_replace('~\?.*$~s', '', $next);
$next = preg_replace('~/[^/]*$~s', '/login.php', $next);
$params=array(
'scope' => 'publish_stream,user_birthday,read_stream,read_friendlists,user_about_me,email,user_checkins,friends_checkins,publish_checkins,publish_actions',
'redirect_uri' => $next
);
$loginUrl = $facebook->getLoginUrl($params);