The ability to determine a file's last access and modification time plays an important role in many administrative tasks, especially in Web applications that involve network or CPU-intensive update operations. PHP offers three functions for determining a file's access, creation, and last modification time, all of which are introduced in this section. fileatime() int fileatime (string filename) The fileatime() function returns filename's last access time in Unix timestamp format, or FALSE on error. An example follows: <?php This returns: --------------------------------------------File last accessed: 06-09-03 1:26:14pm filectime() int filectime (string filename) The filectime() function returns filename's last changed time in Unix timestamp format, or FALSE on error. An example follows: <?php This returns: --------------------------------------------File inode last changed: 06-09-03 1:26:14pm Note The "last changed time" differs from the "last modified time" in that the last changed time refers to any change in the file's inode data, including changes to permissions, owner, group, or other inode-specific information, whereas the last modified time refers to changes to the file's content (specifically, byte size). filemtime() int filemtime (string filename) The filemtime() function returns filename's last modification time in Unix timestamp format, or FALSE otherwise. The following code demonstrates how to place a "last modified timestamp" on a Web page: <?php This returns: --------------------------------------------File last updated: 06-09-03 1:26:14pm
blog comments powered by Disqus |
|
|
|
|
|
|
|