If a user logs in to my page I use sessions. But when the user is on the page for shorter than 30 minutes the session gets removed. How can I make the period shorter to like one minute or something because the user is not always going to be on for so long.

有帮助吗?

解决方案

By default a session is kept active while it is requested at least every 24 minutes. The configuration directive session.gc_maxlifetime sets the idle time allowed between requests to keep the session active; by default the value is set to 1440 seconds (24 minutes). To alter this value, it can be used as well the function ini_set(), which must be invoked before session_start().

So, use ini_set() passing to it the number of seconds required.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top