简体   繁体   中英

PHP session timeout issue

I am getting a session timeout all the time.

When ever a user is idle for some time, he has to re-login. I want him to login again only if he closes his browser . I have not used anything to destroy or unset the session, I only do that in the logout page.

I have set my PHP INI file to set all the session variables. You can browse the Session Variable here at the link.

http://www.providentfeed.com/phpinfo.php

you can write the following code in your php file.

// Session timeout value in seconds. Let's say we increase it to 24 hours
ini_set('session.gc_maxlifetime', 24*60*60);

That's standard behavior. If you want the user to be logged in indefinitely, you'll need to create a cookie and check for its presence in the login page. And simply log the user in if the cookie exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM