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() 清除下緩衝再讀
你代碼寫的有問題,清楚緩衝,訪問時間還是沒有變化。