我遇到了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在返回网址上始终为0。我该如何解决这个问题?
答案 0 :(得分:0)
转到config/config.php
并替换;
$config['enable_query_strings'] = False;
与
$config['enable_query_strings'] = TRUE;
刷新并查看魔力
希望它有所帮助!