How to get the modification time of a file in php: You can use the filectime() function to get the inode modification time of the specified file, such as [filectime("log.txt")]. If we want to get the modification time of the file content, we can use the filemtime() function to achieve this.
Related functions:
filectime() function returns the last inode modification time of the specified file.
(Related learning video recommendations: java course)
This function returns the last time the inode of the file was modified. Returns false if an error occurs. The time is returned as a Unix timestamp.
The filemtime() function returns the last modification time of the file content. If successful, the time is returned as a Unix timestamp. On failure, returns false.
fileatime() function returns the last access time of the specified file.
This function returns the time when the file was last accessed. Returns false if an error occurs. The time is returned as a Unix timestamp.
Code sample:
< ?php $a=filectime("log.txt"); echo "创建时间:".date("Y-m-d H:i:s",$a)." "; $a=filemtime("log.txt"); echo "修改时间:".date("Y-m-d H:i:s",$a)." "; $a=fileatime("log.txt"); echo "访问时间:".date("Y-m-d",$a)." "; ?>
Related recommendations: php training
The above is the detailed content of How to get the modification time of a file in php. For more information, please follow other related articles on the PHP Chinese website!