|
Posted by yawnmoth on 09/04/07 00:28
Say I have the following script:
<?php
$timestamp = filemtime("test.txt");
echo 'original file time<br />'.$timestamp.'<br />';
$fp = fopen("test.txt",'w');
fputs($fp,$data);
fclose($fp);
$timestamp = filemtime("test.txt");
echo 'new file time<br />'.$timestamp.'<br />';
echo 'current time<br />'.time();
?>
When I run it, once, I get this as the output:
original file time
1188864270
new file time
1188864270
current time
1188864484
When I run it again, I get this as the output:
original file time
1188864484
new file time
1188864484
current time
1188864999
Basically, the combination of fopen / fwrite / fclose changes the file
modification time, as evidenced by the second execution of the PHP
script. filemtime, however, does not catch the updated file
modificatoin time when it's ran in the same script.
Any ideas as to why?
Navigation:
[Reply to this message]
|