PHP fileatime () function
Definition and Usage
fileatime () function returns the file's last access time.
If successful, the function will return a Unix timestamp in the form of file's last access time. If it fails, it returns FALSE.
grammar
fileatime(filename)
参数 | 描述 |
---|---|
filename | 必需。规定要检查的文件。 |
Tips and Notes
Note: The results of this function are cached.Use clearstatcache () to clear the cache.
Note: File access time should be changed whenever a file is read in the data block.Part of the Unix system is shut down access time updates, this is because when an application to access a large number of files on a regular basis it is affecting performance, turn off access time updates can improve the performance of such procedures. USENET news spools are a common example. In this file system, this function is useless.
Examples
<?php
echo fileatime("test.txt");
echo "<br />";
echo "Last access: ".date("F d Y H:i:s.",fileatime("test.txt"));
?>
echo fileatime("test.txt");
echo "<br />";
echo "Last access: ".date("F d Y H:i:s.",fileatime("test.txt"));
?>
The code above will output:
1140684501
Last access: February 23 2006 09:48:21.
Last access: February 23 2006 09:48:21.
Complete PHP Filesystem Reference Manual