PHP filemtime()Functions


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The filemtime() function returns the last modified time of the file content.

If successful, the function returns the last modified time of the file content as a Unix timestamp. If it fails, it returns FALSE.

Syntax

filemtime(filename)

Parameter Description
filename Required. Specifies the file to be checked.


Tips and Notes

Note:The result of this function is cached. Use clearstatcache() to clear the cache.


Example

<?php
echo filemtime("test.txt");
echo "<br />";
echo "Last modified: ".date("F d Y H:i:s.",filemtime("test.txt"));
?>

The above code will output:

1139919766
Last modified: February 14 2006 13:22:46.


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions