Home >Backend Development >PHP Problem >How to get file modification time in php
In PHP, you can use the filemtime function to obtain the file modification time. The function of the filemtime function is to return the last modification time of the file content. The syntax is "filemtime(filename)", where the parameter filename represents the file to be checked.
php gets the file modification time
In PHP, you can use the filemtime function to get the file modification time.
filemtime() function definition and usage
filemtime() function returns the last modification time of the file content.
If successful, this function will return the last modification time of the file contents in the form of a Unix timestamp. On failure, returns FALSE.
Syntax
filemtime(filename)
Parameters
filename required. Specifies the documents to be checked.
Tips and Notes
Note: The results of this function will be cached. Please 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.
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to get file modification time in php. For more information, please follow other related articles on the PHP Chinese website!