This only applys to the FAT filesystem, ntfs and greater have file access time support.
Be careful with this function it can degrade script performance if checking several files.
fileatime
(PHP 4, PHP 5)
fileatime — Haalt de laatste toegangs tijd op van een bestand
Beschrijving
Geeft de tijd dat het bestand het laatste geopend is terug of FALSE in het geval van een fout. De tijd wordt terug gegeven in Unix timestamp.
Let op: De atime van een bestand wordt geacht te veranderen elke keer dat er uit dat bestand wordt gelezen. Dit kan kostbaar zijn, gekeken naar de prestatie, als een programma veel bestanden en folders opent. Sommige Unix bestands systemen kunnen gemount worden met atime updates uitgezet om de prestaties te verhogen voor zulke programma's; 'USENET news spools' wordt veel gebruikt als voorbeeld hiervan. Op zulke bestands systemen zal deze functie onbruikbaar zijn.
Note: The results of this function are cached. See clearstatcache() for more details.
Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.
Example#1 fileatime() voorbeeld
<?php
// outputs e.g. somefile.txt was last accessed: December 29 2002 22:16:23.
$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename was last accessed: " . date ("F d Y H:i:s.", fileatime($filename));
}
?>
Zie ook filemtime(), fileinode() en date().
fileatime
16-Dec-2008 08:42
10-Oct-2004 06:12
Using this function on Win98 made me grow grey hair.
Win 98 doesn't save the time for the last access. It only saves the date. This way, the returned timestamp from fileatime(file) is always much too small.
this command will always return false:
if($now - $last_access >1800) {
do something
}
using filemtime() instead did the thing.
