我遇到了 Facebook PHP API 的问题
<?php
$fb_ = new Facebook(array(
'appId' => 'MY_APPID',
'secret' => 'MY_SECRET'
));
$userId = $fb_->getUser();
$errorMessage = null;
if ($userId) {
try {
$user_ = $fb_->api('/me');
if (isset($user_['error_code'])) {
$errorMessage = isset($user_['error_msg']) ? self::$user_['error_msg'] : 'An unknown error occurred';
$errorMessage .= ' (' . $user_['error_code'] . ')';
$user_ = null;
}
} catch (FacebookApiException $e) {
$errorMessage = $e->getMessage();
$user_ = null;
}
}
if (!$user_) {
$loginUrl = $fb_->getLoginUrl(array(
'scope' => 'email,publish_stream,user_birthday,user_location,publish_actions',
'next' => 'http://www.mywebsite.com'
));
echo '<a href="'.$loginUrl.'">Connect!</a>';
}
?>
我的问题是:当我点击“连接!” 我被重定向到 facebook 主页。任何想法?