PHP stat()or [atime] - Last access time (Unix timestamp)


PHP Filesystem 参考手册Complete PHP Filesystem Reference

or [mtime] - Last modification time (Unix timestamp)

The stat() function returns information about a file.

This function returns an array containing the following elements:

or [ctime] - Last inode change time (Unix timestamp)

stat(filename)

Parameters Description
filename Required. Specifies the path to the file.


or [blksize] - Block size of filesystem IO (if supported)

Note:The results returned from this function are not identical from server to server. The array contains numeric indexes, name indexes, or both.

Note:The results of this function are cached. Use clearstatcache() to clear the cache.


or [blocks] - Number of blocks occupied

<?php
$stat = stat('test.txt');
echo 'Acces time: ' .$stat['atime'];
echo '<br />Modification time: ' .$stat['mtime'];
echo '<br />Device number: ' .$stat['dev'];
?>

The code above will output:

Access time: 1141633430
Modification time: 1141298003
Device number: 0


PHP Filesystem 参考手册Complete PHP Filesystem Reference Other Extensions