How to get the modification time of an image file in php

青灯夜游
Release: 2023-03-09 07:54:01
Original
2434 people have browsed it

The filectime() function can be used in PHP to obtain the modification time of the image file. This function can return the last modification time of the specified file, and the syntax format is "filectime(filename)". The return value of this function is in the form of a Unix timestamp, which can be formatted as a local date and time using the date() function.

How to get the modification time of an image file in php

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

php gets the modification time of the image file

<?php
header(&#39;content-type:text/html;charset=utf-8&#39;);
echo "上次修改(Unix 时间戳形式): ".filemtime("1.jpg");
echo "<br />";
echo "上次修改: ".date("Y-m-d H:i:s",filemtime("1.jpg"));
?>
Copy after login

Output:

上次修改(Unix 时间戳形式): 1616986438
上次修改: 2021-03-29 10:53:58
Copy after login

Related function introduction:

filectime() function returns the last modification time of the specified file, which can be used Returns the time when the file contents were last modified.

This function will check the daily modification of the file and the inode modification. Inode modification refers to: modification of permissions, modification of owner, modification of user group or modification of other metadata. The syntax is as follows:

filectime(filename)
Copy after login

Parameters:

  • filename: required. Specifies the documents to be checked.

Return value:

  • If successful, this function will return the last modification time of the file in the form of a Unix timestamp. On failure, returns FALSE.

Note:

  • #The result of this function will be cached, and you need to use clearstatcache() to clear the cache.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to get the modification time of an image file in php. 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