Facebook退出无效
我希望当用户点击退出时,用户将从应用以及Facebook注销。
<?php if($ this-> session-> userdata('user_id')):
$CI = & get_instance();
$CI->config->load("facebook",TRUE);
$config = $CI->config->item('facebook');
$this->load->library('Facebook', $config);
$myurl = site_url('user/mainLogout');
$token= $this->facebook->getAccessToken();
$params = array('next' => $myurl,'access_token'=>$token);
$logoutUrl=$this->facebook->getLogoutUrl($params);
>
< li style =“float:right”>< a href =“<?php echo $ logoutUrl; // site_url('logout');?>”> Logout< / a> < /锂> <?php endif; ?>
在mainLogout()
中function mainLogout(){
$SessionArray = array(
'user_id' => '',
'user_email' => '',
'role' => ''
);
$this->session->unset_userdata($SessionArray);
$this->session->sess_destroy();
$this->facebook->destroySession();
setcookie('PHPSESSID', '', time()-3600, "/");
setcookie ("fbss_XXXXXXXXXX", "", time() - 3600);
unset($_SESSION);
session_destroy();
redirect(site_url(''));
}
答案 0 :(得分:0)
You have to destroy the session
using the following commands.
unset($_SESSION);
// Delete all session variables
session_destroy();