Retrieve the last access time of “webdictionary.txt”:
<?php echo fileatime(“webdictionary.txt”); echo “<br>”; echo “Last access: “.date(“F d Y H:i:s.”, fileatime(“webdictionary.txt”)); ?> |
The fileatime() function returns the last access time of the specified file.
Note: The result is cached. Use clearstatcache() to clear the cache.
Note: The access time (atime) of a file changes each time the file’s data is read. This can reduce performance if an application accesses a large number of files or directories. Some Unix systems disable access time updates to improve performance, making this function ineffective in those cases.
fileatime(filename) |
Parameter |
Description |
filename |
Mandatory. Specifies the path to the file to check. |
Return Value: |
Returns the last access time as a Unix timestamp on success, or |
PHP Version: |
4.0+ |