定义
fileatime()函数返回指定文件的最后访问时间。
语法
PHP fileatime()函数具有以下语法。
fileatime(filename)
参数
| 参数 | 是否必须 | 描述 |
|---|---|---|
filename |
需要。 | 要检查的文件 |
注意
此函数的结果被缓存。使用clearstatcache()清除缓存。
返回值
返回文件上次访问的时间,或失败时为FALSE。时间以Unix时间戳返回。
实例
PHP函数fileatime()返回最后访问的时间。
它返回时间的Unix时间戳,然后您需要使用对date()的调用进行转换,如下所示:
<?php
/*
http://www.manongjc.com/article/1781.html
作者:码农教程
*/
$contacts = \"text.txt\";
$atime = fileatime($contacts);
$mtime = filemtime($contacts);
$atime_str = date(\"F jS Y H:i:s\", $atime);
$mtime_str = date(\"F jS Y H:i:s\", $mtime);
print \"File last accessed: $atime_str\\n\";
print \"File last modified: $mtime_str\\n\";
echo fileatime(\"test.txt\");
echo \"\\n\";
echo \"Last access: \".date(\"F d Y H:i:s.\",fileatime(\"test.txt\"));
?> 继续阅读与本文标签相同的文章
上一篇 :
被骂了三年,谷歌Dropout专利还是生效了
下一篇 :
php filectime()函数
-
5G核心网建设是采用SA独立组网还是NSA独立组网
2026-05-15栏目: 教程
-
买了iPhone手机,旧设备上数据怎样迁移,这有3种办法快速解决
2026-05-15栏目: 教程
-
昔日电商巨头轰然倒塌!烧光几十亿补贴后,欠下工资5600万
2026-05-15栏目: 教程
-
从做流量的梦到踏实做生意,小程序成为互联网逆袭工具!
2026-05-15栏目: 教程
-
Uber在巴黎上线摩托车租赁服务,加速共享两轮布局对击Lyft
2026-05-15栏目: 教程
