How to get file modification time in php

藏色散人
Release: 2023-03-02 08:04:01
Original
2557 people have browsed it

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.

How to get file modification time in php

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)
Copy after login

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"));
?>
Copy after login

The above code will output:

1139919766
Last modified: February 14 2006 13:22:46.
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template