我什么都试过了。我将我的域更改为 localhost 以外的域。
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller Extends CI_Controller
{
var $data;
var $master;
function __construct()
{
parent::__construct();
$this->data = array();
$this->master = "layout/master";
parse_str( $_SERVER['QUERY_STRING'], $_REQUEST );
$CI = & get_instance();
$CI->config->load("facebook",TRUE);
$config = $CI->config->item('facebook');
$this->load->library('Facebook', $config);
$user = $this->facebook->getUser();
if ($user == 0)
$this->data['login_url'] = $this->facebook->getLoginUrl(array("scope" => "user_about_me"));
else{
$user = $this->facebook->api('/me');
$this->data['logout_url'] = $this->facebook->getLogoutUrl();
}
print_r($user);
print_r($this->facebook->getAccessToken());
}
}
为什么我成功获取了AccessToken,但$user 仍然返回0?我搜索了整个stackoverflow和谷歌。
facebook 成功将我重定向回我的网站,如果我不清楚..