我正在尝试这段代码:
$this->load->library('fbconnect');
if ($this->fbconnect->user){
echo "<pre>";
print_r($this->fbconnect->user);
echo "</pre>";
}else{
echo "could not login at this tym";
}
它始终显示“其他”条件的回声部分。'fbconnect' 是包含 facebookconnect 代码的库名称,'user' 正在从 fb 函数 'getUser()' 获取值
这是:'fbconnect.php'库的代码:
class Fbconnect extends Facebook{
public $user = NULL;
public $user_id = NULL;
public function Fbconnect(){
$ci=& get_instance();
$ci->config->load('facebook',TRUE);
$config = $ci->config->item('facebook');
parent::__construct($config);
$this->user_id = $this->getUser();
$me=NULL;
if($this->user_id){
try{
$me = $this->api('/me');
$this->user = $me;
}
catch(FacebookApiException $e){
error_log($e);
}
}
}
}