Filesystem 函数
PHP 手册

filemtime

(PHP 4, PHP 5)

filemtime取得文件修改时间

说明

int filemtime ( string $filename )

返回文件上次被修改的时间,出错时返回 FALSE。时间以 Unix 时间戳的方式返回,可用于 date()

Note: 本函数的结果会被缓存。更多信息参见 clearstatcache()

Tip

PHP 5.0.0 起本函数也可被某些 URL wrapper 使用。参考支持的协议/封装协议列表 来看哪些 wrapper 支持 stat() 系列函数的功能。

本函数返回文件中的数据块上次被写入的时间,也就是说,文件的内容上次被修改的时间。

Example #1 filemtime() 例子

<?php
// outputs e.g.  somefile.txt was last modified: December 29 2002 22:16:23.
$filename 'somefile.txt';
if (
file_exists($filename)) {
    echo 
"$filename was last modified: " date ("F d Y H:i:s."filemtime($filename));

}
?>

参见 filectime()stat()touch()getlastmod()


Filesystem 函数
PHP 手册