2016-07-27 46 views
0

定時任務功能,我有一個問題,即PHP:可以在PHP實現對窗口

$filetime_f = md5(filemtime("path.txt"));sleep(5); 
$filetime_n = md5(filemtime("path.txt")); 

,當我在這5秒,改變的內容在path.txt不管是什麼,它仍然是一樣的,請給我一個正確的功能

回答

0

filemtime的結果緩存(見notes)在一個PHP過程中。所以你必須手動清除它clearstatcache

$filetime_f = md5(filemtime("path.txt")); 
sleep(5); 
clearstatcache(); 
$filetime_n = md5(filemtime("path.txt"));