To set the php survival time, we can use the session_set_cookie_params function or modify the php.ini file. Let me introduce it below.
The first method: session_set_cookie_params
Function prototype void session_set_cookie_params ( int $lifetime [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]] )
The code is as follows
|
Copy code
|
||||||||
session_set_cookie_params($lifetime); session_start();
// Save for one day 1. Set "session.use_cookies" to 1 and turn on Cookie to store SessionID, but the default is 1 and generally does not need to be modified; 2. Change "session.cookie_lifetime" to positive infinity (of course there is no parameter for positive infinity, but there is no difference between 999999999 and positive infinity); 3. Set "session.gc_maxlifetime" to the same time as "session.cookie_lifetime";
4. Modify the php.ini file session.gc.lifetime=10000
http://www.bkjia.com/PHPjc/632658.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632658.htmlTechArticleTo set the php survival time, we can use the session_set_cookie_params function or modify the php.ini file. The editor will introduce it below. one time. The first method: session_set_cookie_params...
|