You are here: doing filemtime after fopen / fwrite / fclose « PHP Programming Language « IT news, forums, messages
doing filemtime after fopen / fwrite / fclose

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация