Latest web development tutorials

PHP filemtime () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

filemtime () function returns the contents of the file was last modified.

If successful, the function will return a Unix timestamp in the form of file content was last modified. If it fails, it returns FALSE.

grammar

filemtime(filename)

参数 描述
filename 必需。规定要检查的文件。


Tips and Notes

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


Examples

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

The code above will output:

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


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual