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

Posted by ZeldorBlat on 09/04/07 02:22

On Sep 3, 8:28 pm, yawnmoth <terra1...@yahoo.com> wrote:
> 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?

Read this:

<http://www.php.net/clearstatcache>

 

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

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