Does the cookie have an expiration time and the session has no expiration time?
The user name or password is incorrect.
'; Include $ _ SERVER [DOCUMENT_ROOT].'/template/footer. php'; exit ();} else {echo"
$ Login_email ". '. welcome to'. WEBSITE_NAME .'.
'; // Write to the session. $ _ SESSION ["save_username"] = "$ login_email";} // sets setcookie. setcookie ("setcookie", "$ login_email", time () + 60); // Set the expiration time for one hour.?>
Welcome
, You have logged on. Log out
Welcome administrator
, Log out
Welcome from
Please register or log on
By the way, it seems awkward for me to exit.
Unset ($ _ SESSION); session_destroy (); if (! $ _ SESSION) {echo "log out successfully.
Return to the home page 2 seconds later. ";// Header (" refrech: 2; URL = http://www.09-29.com/"); header (" refresh: 1; url = /");}
Reply to discussion (solution)
The session is implemented based on cookies and cannot be expired.
No output is available before the header function.
Tested several times,
Comment unset ($ _ SESSION); use session_destroy (); the result shows nothing different?
Session_destroy (); I heard that the whole site session is canceled.
I used browser a and browser B to log on at the same time. I logged out in browser a. didn't my browser exit?
The cookie contains a phpsessid. each ssid corresponds to a session file. Have you synchronized your ssid when logging on to different browsers? Obviously, your ssid must be different. In fact, your two browsers correspond to two sessions. what is the relationship between a and B after you cancel a session?
Tested several times,
Comment unset ($ _ SESSION); use session_destroy (); the result shows nothing different?
Session_destroy (); I heard that the whole site session is canceled.
I used browser a and browser B to log on at the same time. I logged out in browser a. didn't my browser exit?
Cookie is used in combination with session. the cookie of each browser is independent. it does not mean that browser a will exit if browser B exits.
Both cookies and Sessions have an expiration time.
The session depends on the cookie.
Session. auto_start is enabled and session_start () is automatically completed ()
The difference is whether session_start () is required before SESSION is used ();
When
Session. auto_start = on
Run session_start () to generate a new session_id.
Session. auto_start = on has the advantage that it will not cause errors at any time because it forgets to execute session_start () or session_start () in the program.
The disadvantage is that if you are using third-party code, you must delete all session_start (). Otherwise, the correct result cannot be obtained.
Ignore the above reply ......
By default, sessions are stored based on cookies. when you cancel a session, you must also cancel the cookie.
Sessionid passed through cookie
You can use session. cookie_lifetime to set the Expiration Time (0 by default)
However, you must pay attention to the cooperation with session. gc_maxlifetime.
In addition
Setcookie ("setcookie", "$ login_email", time () + 60); // Set the expiration time for one hour
This comment is incorrect! Should be one minute
Both session and cookie expire.