session is not destroyed

前端 未结 5 609
醉梦人生
醉梦人生 2021-01-27 06:55

i have this file

secure.php

session_start();
if(empty($_SESSION[\'u_name\'])) {
    header(\"Location:emprego.php\");
}

if(isset($_GET[\'logout\'])) {
         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 07:31

    If you're using session cookies, also try expiring the session cookie explicitly, like this:

    if (ini_get("session.use_cookies")) {
        $params = session_get_cookie_params();
        setcookie(session_name(), '', time() - 42000,
            $params["path"], $params["domain"],
            $params["secure"], $params["httponly"]
        );
    }
    

    Also, going back in the browser only loads a cached copy of the page. If you tried interacting with the cached page to fetch a new page from the server, you shouldn't be able to proceed.

提交回复
热议问题