php - delete session files after a time from creation -


I am saving my session from other directory / temp directory using the / session> directory Please. ( using session_save_path ("session") )

Also, there is a code to kill a session that creates 10 minets and logout.

But I mentioned that if the user logs in and closes his computer for example, then my logout and session code dosage is not lost, so the session file session will remain in the directory . / P>

I wanted to know that there is a way to delete session files in the / session after creation time?

I used this code for this

  if ($ handle = opendir ('sessions')) {while (false! == ($ file = readdir ( $ Handle)) {if (filectime ($ file) & lt; (time () -600)) {// 600 = 10 * 60 Unlink ($ file); }}}  

But, not working, I think this filectime ($ file)

thanks

You should not need it. PHP automatically applies a garbage collection mechanism to remove passive session files.

See PHP's configuration options for more information.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -