Home  >  Article  >  Backend Development  >  How to use php filemtime function

How to use php filemtime function

藏色散人
藏色散人Original
2019-05-28 14:46:522510browse

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)

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

Output:

1139919766
Last modified: February 14 2006 13:22:46.

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!

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