How to use php filemtime function

藏色散人
Release: 2023-02-22 21:24:01
Original
2519 people have browsed it

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.

How to use php filemtime function

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

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

Output:

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

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!

Related labels:
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