[英]filemtime() constant during execution despite changes to file
試試跑步
<?php
echo filemtime("test.txt")."\n";
sleep(4);
file_put_contents("test.txt", "test");
echo filemtime("test.txt")."\n";
?>
對我來說打印的命令行:
1343490984
1343490984
那可能不對,可以嗎?
從filemtime
文檔 :
注意:此函數的結果已緩存。 有關更多詳細信息,請參閱
clearstatcache()
。
在再次調用filemtime()
之前,需要調用clearstatcache()
:
echo filemtime("test.txt")."\n";
sleep(4);
file_put_contents("test.txt", "test");
clearstatcache();
echo filemtime("test.txt")."\n";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.