开发者

PHP session timeout issue

开发者 https://www.devze.com 2023-02-25 22:29 出处:网络
I am getting a sess开发者_如何学JAVAion 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 any

I am getting a sess开发者_如何学JAVAion 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消