filemtime()

创建于 2024-12-03 / 27
字体: [默认] [大] [更大]
❮ PHP 文件系统参考手册

实例

获取上次修改文件内容的时间:

<?php
echo filemtime("webdictionary.txt");
echo "<br>";
echo "Content last changed: ".date("F d Y H:i:s.", filemtime("webdictionary.txt"));
?> 运行实例 »

定义和用法

filemtime() 函数返回文件内容上次的修改时间。

若成功,则时间以 Unix 时间戳的方式返回。若失败,则返回 false。

注释: The result of this function is cached. Use clearstatcache() to clear the cache.

语法

filemtime(filename)

参数值

参数 描述
filename 必需。规定要检查的文件。

说明

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


提示和注释

提示:本函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。



技术细节

返回值: 文件内容最后一次修改为 Unix 时间戳,失败为 FALSE
PHP 版本: 4.0+

❮ PHP 文件系统参考手册
0 人点赞过