Folks,
How can I remove session data from the server after x number of seconds of inactivity? I assume the solution would use the session_gc() function.
A.
Folks,
How can I remove session data from the server after x number of seconds of inactivity? I assume the solution would use the session_gc() function.
A.
Last edited by marain; 09-30-2022 at 01:44 PM. Reason: Reword question to remove the word "script".
The session destroy() function can be used to end a PHP session. This function doesn't need any arguments, and all the session variables can be deleted with a single call. If you only want to get rid of a single session variable, you can use the unset() function.
Thank you, but neither unset() nor destroy() satisfy my needs. I want session data to not disappear immediately but, rather, upon passage of a defined period of inactivity. I suspect a gc (garbage collection) function is needed.
Last edited by marain; 10-03-2022 at 06:17 PM. Reason: Clarify response
Bookmarks