stat
Provide information about the document
stat()
function returns information about the file.
<?php $file = fopen("test.txt","r"); print_r(stat($file)); fclose($file); ?>
输出类似:
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 )
fstat ( file )
parameter | describe |
---|---|
file | Required. Specify documents to be inspected. |
Gets statistics for the file specified by the file . If the file is a symbolic connection, the statistics are about the connected file itself, not the symbolic connection.
If an error occurs, stat()
returns false and a warning is issued.
The returned array contains statistics for the file, which has the following listed units, and the array subscript starts from zero. In addition to numeric indexes, it can also be accessed through associated indexes starting from PHP 4.0.6.
Digital subscript | Associated Key Name (from PHP 4.0.6) | illustrate |
---|---|---|
0 | dev | Device name |
1 | ino | Number |
2 | mode | inode protection mode |
3 | nlink | Number of connected |
4 | uid | Owner's user id |
5 | gid | Owner's group id |
6 | rdev | Device type, if it is an inode device |
7 | size | Number of bytes of file size |
8 | atime | Last access time (Unix timestamp) |
9 | mtime | Last modified time (Unix timestamp) |
10 | ctime | Last time changed (Unix timestamp) |
11 | blksize | Block size of file system IO |
12 | Blocks | The number of blocks occupied |