Go Back   Cloud Computing > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-11, 22:09
BOD Member
 
Join Date: Aug 2011
Posts: 76
Default filemtime Questions

I have been using filemtime to get the Last Modified date and time on specific files for my site. However, I would like to check the entire directory of my site in this manner but I am unsure if this is possible.

Also, is it possible to output the last time a site's database was updated, using this manner or any other? Since the code isn't updated very often, but the database is, I'd like to have it noted on the site when the last update of any sort happened.

Thanks in advance for any tips.
Reply With Quote
  #2 (permalink)  
Old 10-11-11, 08:54
BOD Member
 
Join Date: Jul 2011
Posts: 37
Default

[ Examples with filemtime ] PHP 3, PHP 4, PHP 5

int filemtime ( string filename )

filemtime returns the last modification of the file filename , or FALSE on error.

filemtime returns the time of writing file data blocks. Use date of the result to get a human readable date of modification.

Example filemtime:

<? Php
/ / the output is: somefile.txt was last modified: December 29 2002 22:16:23.

$ filename = 'somefile.txt' ;
if ( file_exists ( $ filename )) {
echo "$ filename has been modified: " . date ( "F d YH: i: s." , filemtime ( $ filename ));
}
?>

Note

The results of this function are cached. See the function clearstatcache for more details.
Array

See also filectime , stat , touch and getlastmod .
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 01:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.