The lstat() function returns information about a file or symbolic link.
This function will return an array containing the following elements:
[0] or [dev] - device number
[1] or [ino] - inode number
[2] or [mode] - inode protection mode
[3] or [nlink] - number of connections
[4] or [uid] - The user ID of the owner
[5] or [gid] – The owner’s group ID
[6] or [rdev] - inode device type
[7] or [size] - file size in bytes
[8] or [atime] - last access time (Unix timestamp)
[9] or [mtime] - Last modified time (Unix timestamp)
[10] or [ctime] - Last inode change time (Unix timestamp)
[11] or [blksize] - Block size for file system IO (if supported)
[12] or [blocks] - number of occupied blocks
lstat(file)
parameter | describe |
---|---|
file | Required. Specifies the path to be checked. |
Note: The results returned from this function are not the same as server-to-server results. This array contains numeric indexes, name indexes, or both.
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
Tip: The lstat() function is roughly similar to the stat() function. The only difference is that if the file parameter is a symbolic link, the status of the symbolic link (rather than the status of the file pointed to by the symbolic link) is returned.
<?phpprint_r(lstat("test.txt"));?>
The above code 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)