所以我试图获取文件的最后修改日期,然后将其更新到当前时间,但是当我查看结果时,我在$ oldtime和$ newtime中获得了SAME时间戳
$file = 'test.txt';
$oldtime = filemtime($file);
touch($file, time());
$newtime = filemtime($file);
echo '<h1>old</h1>';
print_r(getdate($oldtime));
echo '<h1>new</h1>';
print_r(getdate($newtime));
Run Code Online (Sandbox Code Playgroud)
dev*_*ler 14
clearstatcache在touch文件之后使用以获得适当的修改时间值.
因为您之前使用filemtime过,结果是缓存了,在第二次调用时,结果从该缓存中拉出而不是直接检查文件.
| 归档时间: |
|
| 查看次数: |
4235 次 |
| 最近记录: |