Home > Article > Backend Development > How to use php filemtime function
php The filemtime function is used to return the last modification time of the file content. Its syntax is filemtime(filename). The parameter filename is required and refers to the file to be checked.
#php filemtime function how to use?
Definition and usage
The filemtime() function returns the last modification time of the file content.
If successful, the time will be returned as a Unix timestamp. On failure, returns false.
Syntax
filemtime(filename)
Parameters
filename required. Specifies the documents to be checked.
Explanation
This function returns the time when the data block in the file was last written, that is, the time when the content of the file was last modified.
Tips and comments
Tips: The results of this function will be cached. Please use clearstatcache() to clear the cache.
Example
<?php echo filemtime("test.txt"); echo "Last modified: ".date("F d Y H:i:s.",filemtime("test.txt")); ?>
Output:
1139919766 Last modified: February 14 2006 13:22:46.
The above is the detailed content of How to use php filemtime function. For more information, please follow other related articles on the PHP Chinese website!