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


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

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

The fstat() function returns information about an open file.

This function returns an array containing the following elements:

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

fstat(file)

Parameters Description
file Required. Specifies the open file to be checked.


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

Note:The result returned from this function is not the same from server to server. This array contains numeric indexes, named indexes, or both.

Tip:The fstat() function is roughly similar to the stat() function. The only difference is that when using the fstat() function, the file must already be open.


or [blocks] - Number of blocks occupied

<?php
$file = fopen("test.txt","r");
print_r(fstat($file));
fclose($file);
?>

The code above will output:

Array
(
[0] => 0
[1] => 0
[2] => 33206
[3] => 1
[4] => 0
[5] => 0
[6] => 0
[7] => 92
[8] => 1141633430
[9] => 1141298003
[10] => 1138609592
[11] => -1
[12] => -1
[dev] => 0
[ino] => 0
[mode] => 33206
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 92
[atime] => 1141633430
[mtime] => 1141298003
[ctime] => 1138609592
[blksize] => -1
[blocks] => -1
)


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