0

i have implement the php sdk for the facebook login in my project.. and all works with the login except the logout.

how can i write the code to call a function from the controller to destroy the session?

tried a lot of things but can´t get understand how can i do this..

hope that somebody can help me with this.

my model with the logouturl is this:

'logoutUrl' => $this->facebook->getLogoutUrl()

and the function in the controller is this:

public function logout()
{   
     $this->CI->session->sess_destroy('logourUrl');
     $this->load->view('home');
     // do more thing you want to do such as redirect
}
4

1 回答 1

1

尝试在您的控制器中添加以下内容

 function logout()
        {   $logout = $this->facebook->getLogoutUrl(array('next'=>'url to be redirected after logout'));
            $this->facebook->destroySession();
            $this->session->sess_destroy();
            header("Location:$logout");
        }

您不需要加载视图,因为 facebook 会在注销后自动重定向到给定的 url。

于 2013-06-09T18:56:28.447 回答