This article mainly introduces the problem of session logout and login in php. If you need a friend, please refer to it and hope to help you.
This article mainly introduces the problem of session logout and login in php. If you need a friend, please refer to it and hope to help you.
In php, if the session is used to determine whether the user logs in or out, it can be like this:
Session_start ();
Session_destroy ();
The session is ended. In the next sentence, JavaScript should be written to redirect the page.
Script alert ("logged out! "); Location. href =" login. php "; script
If it is a framework page, do not use location directly. Because this will jump in a small frame page, the intention must be that the entire framework should jump over. Therefore, "parent." Must be added before location .".
The entire process is as follows (for the Framework page only ):
The Code is as follows:
Session_start ();
Session_destroy ();
// To redirect the entire framework page to the login page
Echo "script" alert ('logged out '); parent. location. href = 'login. php'; script ";
?>
,