It is determined by the session ID, what is the session ID, is the file name of the session file, session ID is randomly generated, so to ensure uniqueness and randomness, to ensure that the session security. In general, if the lifetime of the session is not set, the session ID is stored in memory, the ID is automatically logged off after the browser is closed, and a session ID is re-registered after the page is re-requested.
If the client does not disable cookies, the cookie plays the role of storing the session ID and session lifetime when the session is started. Let's set the lifetime of the Session manually:
Session_Start (); Save the day $lifeTime = 24 * 3600; Setcookie (Session_name (), session_id (), time () + $lifeTime, "/"); ?> |
In fact PHP5 session also provides a function session_set_cookie_params (); To set the lifetime of the PHP5 session, the function must be called before the session_start () function call:
Save the day $lifeTime = 24 * 3600; Session_set_cookie_params ($lifeTime); Session_Start (); ?> |
http://www.bkjia.com/PHPjc/321407.html www.bkjia.com true http://www.bkjia.com/PHPjc/321407.html techarticle It is determined by the session ID, what is the session ID, is the file name of the session file, session ID is randomly generated, so can guarantee uniqueness and randomness, to ensure that ...