Prev | Current Page 347 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

php";
printf("File last accessed: %s", date("m-d-y g:i:sa", fileatime($file)));
?>
This returns the following:
File last accessed: 06-09-03 1:26:14pm
Determining a File??™s Last Changed Time
The filectime() function returns a file??™s last changed time in Unix timestamp format, or
FALSE on error. Its prototype follows:
int filectime(string filename)
An example follows:
$file = "/usr/local/apache2/htdocs/book/chapter10/stat.php";
printf("File inode last changed: %s", date("m-d-y g:i:sa",
filectime($file)));
?>
This returns the following:
File inode last changed: 06-09-03 1:26:14pm
?– Note The last changed time differs from the last modified time in that the last changed time refers
to any change in the file??™s inode data, including changes to permissions, owner, group, or other inodespecific
information, whereas the last modified time refers to changes to the file??™s content (specifically,
byte size).
286 CHAPTER 10 ?–  WORKING WITH THE FI LE AND OPERATING SYSTEM
Determining a File??™s Last Modified Time
The filemtime() function returns a file??™s last modification time in Unix timestamp
format, or FALSE otherwise. Its prototype follows:
int filemtime(string filename)
The following code demonstrates how to place a ???last modified??? timestamp on a
Web page:
$file = "/usr/local/apache2/htdocs/book/chapter10/stat.php";
echo "File last updated: ".


Pages:
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359