簡體   English   中英

filemtime()在執行期間保持不變,盡管文件已更改

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM