235
seCure sessIon storAge
And if it does, it is deleted from the file system with u nlin k().
e function then returns true.
gc() Whenever gc() is called, approximately once every several hundred session
starts, session files are searched based on last access time, and deleted if time is older
than passed in expiration time.
First, glob is used to build an array of the files in the session directory, which is used
in a foreach loop to process each file.
foreach (glob($sessionPath) as $sessionFile)
en filetim e() is used to check file age and determine if the file is old enough
to expire and delete.
if (filemtime($sessionFile) + $maxLife < time())
If the file should be expired, the file is checked one last time to make sure it still
exists with
if(is_file ...