2015-05-26 29 views
0

這裏瀏覽器關閉後退出的問題會話不會過期或用戶在Firefox的固定標籤

每一件事情是工作的罰款與所有瀏覽器和火狐取消固定標籤以及 ,但在Firefox的情況下,固定標籤頁: 當關閉瀏覽器並再次返回,,,仍然登錄

我使用這兩行來強制會話過期關閉瀏覽器。

ini_set('session.cookie_lifetime', 0); 
session_set_cookie_params(0); 

回答

1

使用session_destroy()功能在瀏覽器關閉。
logout.php

//This is the page that will destroy all your session, call the code on this page before the browser is closed. 
<?php session_start(); 

session_destroy(); 

?> 

mypage.php

<script> // use ajax call to execute the code on before unload page mypage.hp 

window.onbeforeunload = function(){ //send a small ajax call to logout.php so that the session wil get destroyed 
    $.ajax({ 
    method:'post', 
    url: 'logout.php', 
    data: 'nothing' 
    }) 
} 

</script> 
+0

會話瀏覽器關閉後已被破壞,但沒有與FF寄託在瀏覽器關閉 – wizard999

+0

標籤 以及如何實現這一目標,, session_destroy你是否在瀏覽器關閉時嘗試'session_destroy()'函數? –

+0

你可以解釋更多請給我一個示例代碼 – wizard999