Home>Article>Backend Development> How to get the latest modification time of a file in php

How to get the latest modification time of a file in php

青灯夜游
青灯夜游 Original
2022-02-18 12:06:14 2597browse

In PHP, you can use the filemtime() function to get the latest modification time of the file. The function of this function is to get and return the last modification time of the file (in the form of timestamp). The syntax "filemtime(to be checked) file path)".

How to get the latest modification time of a file in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In PHP, you can use the filemtime() function to get the latest modification time of the file.

The filemtime() function returns the last modification time of the file content; if successful, the function will return the last modification time of the file content in the form of a Unix timestamp. On failure, returns FALSE.

How to get the latest modification time of a file in php

Because the filemtime() function returns the modification time in the form of a timestamp, we can use the date() function to format it into a readable time format.

How to get the latest modification time of a file in php

We open the properties panel of index.phpd and see if the modification time is correct:

How to get the latest modification time of a file in php

ok, yes Yes.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to get the latest modification time of a file in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn