php fileatime?取不到上次访问时间怎么办?

WBOY
发布: 2016-06-23 14:27:55
原创
990 人浏览过

php fileatime

$file='image/open1.txt';
$fopen=fopen($file,'r');
$content=fread($fopen,filesize($file));
echo $content;
date_default_timezone_set('Asia/Chongqing');
echo date("Y年m月d日 H:i:s",fileatime($file));
fclose($file);
?>
不管刷新、重新访问页面多少次,页面显示时间2013年12月05日 20:03:31总是不变。
这是为什么呢?

回复讨论(解决方案)

http://php.net/manual/en/function.fileatime.php

Note:
The atime of a file is supposed to change whenever the data blocks of a file are being read. This can be costly performance-wise when an application regularly accesses a very large number of files or directories.
Some Unix filesystems can be mounted with atime updates disabled to increase the performance of such applications; USENET news spools are a common example. On such filesystems this function will be useless.

不同的文件系统使用都会不同的..

可以试下clearstatcache() 清除下缓存再读

你代码写的有问题,清楚缓存,访问时间还是没有变化。

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!