Php Facebook连接注销

Php Facebook连接注销,php,facebook,codeigniter,session,Php,Facebook,Codeigniter,Session,我正在使用Facebook Connect SDK for Php开发一个基于Php的应用程序,其中包含CodeIgniter。到目前为止,所有用户都可以登录系统,但对于某些用户,当他们尝试注销时,会话不会过期!这真的很奇怪,因为这对某些用户有效,而对其他用户无效! 以下是我使用Facebook提供的基本注销代码: 控制器: if ($user) { $data['logoutUrl'] = $this->facebook->getLogoutUrl();

我正在使用Facebook Connect SDK for Php开发一个基于Php的应用程序,其中包含CodeIgniter。到目前为止,所有用户都可以登录系统,但对于某些用户,当他们尝试注销时,会话不会过期!这真的很奇怪,因为这对某些用户有效,而对其他用户无效! 以下是我使用Facebook提供的基本注销代码: 控制器:

if ($user) {
            $data['logoutUrl'] = $this->facebook->getLogoutUrl();
视图:


您正在销毁本地会话,但用户不会使用此代码从Facebook注销。因此,只要初始化SDK,应用程序就会缓存用户的Facebook会话。您需要从Facebook和您的站点注销该用户,或者检查更好的登录/Facebook连接功能,以不自动登录该用户

如果需要更多说明,请在初始化Facebook SDK的位置提供登录功能和代码

更新

这是我为FB connect提供的:

$this->_facebook = new Facebookapi($settings);

// Try to get the user's id on Facebook
$userId = $this->_facebook->getUser();

// If user is not yet authenticated, the id will be zero
if( $userId == 0 ){
    $this->_loginUrl = $this->_facebook->getLoginUrl(array('scope'=>'email')); 
}else{
    $_user = $this->_facebook->api('/me');
    $this->_user = new Users();
    $this->_user->load($_user['username'], 'facebook');
}
所以,若用户登录facebook,我会检查是否已经有这样的用户名的用户,若有,我会将用户加载到对象。用户将自动登录回我的网站,无需再次单击“连接”按钮


你需要检查你的代码,以确保你没有像我一样的东西,否则你的用户将永远不会注销,除非先从facebook注销。

UAWDT,你能在这里添加更多的细节,让这更清楚吗?我想我能猜出你的大部分意思,但我不确定。我也做了一些小的修改,但有些地方不清楚是怎么说的。你能添加你的登录功能和控制器的构造函数来处理登录/facebook连接功能吗?
function RemoveSess(){
                $.post("<?php echo base_url(); ?>"+ "/facebook_cn/remSess", function(data){
                        document.getElementById('message').innerHTML = $data;       
                      });   
            }
function remSess()
{
    $data2 = array('user_id' => '','logged_in' => '');
    $this->session->unset_userdata($data2);
    $this->session->sess_destroy();
    session_destroy();
    $data = array('sess' => "gone" );
    echo json_encode($data["sess"]="gone");
}
$this->_facebook = new Facebookapi($settings);

// Try to get the user's id on Facebook
$userId = $this->_facebook->getUser();

// If user is not yet authenticated, the id will be zero
if( $userId == 0 ){
    $this->_loginUrl = $this->_facebook->getLoginUrl(array('scope'=>'email')); 
}else{
    $_user = $this->_facebook->api('/me');
    $this->_user = new Users();
    $this->_user->load($_user['username'], 'facebook');
}