session is not destroyed

前端 未结 5 648
醉梦人生
醉梦人生 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:35

    http://nl2.php.net/manual/en/function.session-destroy.php

    Take a look at example 1 here. It clearly states that you have to clear $_SESSION as well.

    if(isset($_GET['logout'])) {
        unset($_SESSION['u_name']); //makes it non-existent (it does unset) that variable
        session_destroy();
        header("Location:emprego.php");
    }
    

提交回复
热议问题