我遇到的问题是,当用户第一次登录这个 facebook iframe 应用程序时,他会被发送到一个带有 facebook 徽标的空白页面。以下是屏幕截图。
以下是我的代码,我正在使用新的 PHP Sdk:
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'cookie' => true,
));
$this->facebook=$facebook;
$this->session = $facebook->getSession();
$this->me = null;
// Session based API call.
if(!$this->session){
if (!$this->session) {
//echo $loginUrl = $facebook->getLoginUrl($par);
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'display' => 'page',
'req_perms' => 'email,publish_stream,status_update,user_birthday,user_location,user_work_history'
));
$this->request->redirect($loginUrl);
}
}
if ($this->session) {
try {
$this->uid = $facebook->getUser();
$this->user = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}