我在使用 facebook connect php 库时遇到问题。基本上在返回 url 上我的用户是 0。这是我的代码:
public function facebook_login()
{
$params = array(
'appId' => 'XXXX',
'secret' => 'XXXX',
'cookie' => TRUE
);
$facebook = $this->load->library('facebook', $params);
$user = $facebook->getUser();
if (empty($user))
{
$url = $facebook->getLoginUrl(array(
"redirect_uri" => site_url('/auth/facebook/connect')
));
header("Location: $url");
exit;
}
}
public function facebook_connect()
{
$params = array(
'appId' => 'XXXX',
'secret' => 'XXXX',
'cookie' => TRUE
);
$facebook = $this->load->library('facebook', $params);
$user = $facebook->getUser();
print_r($user);die;
}
$user 在返回 url 上始终为 0。我怎样才能解决这个问题?