PHP lstat() function

Definition and usage

The lstat() function returns information about the file or symbolic link.

Syntax

lstat(file)
Parameter Description
file Required. Specifies the file to be checked.

Description

Get by file Statistical information of the file or symbolic link specified by the parameter.

Return format of lstat()

Numeric index Associated key name (since PHP 4.0.6) Description
0 dev Device name
1 ino Number
2 mode inode protection mode
3 nlink Number of connections
4 uid User ID of the owner
5 gid Group ID of the owner
6 rdev Device type, if it is an inode device
7 size Number of bytes in file size
8 atime Last access time (Unix timestamp)
9 mtime Last modification time (Unix timestamp)
10 ctime Last modification time (Unix timestamp)
11 blksize Dimensione del blocco IO del file system
12 blocks Numero di blocchi occupati

Suggerimenti e commenti

Suggerimento:Questa funzione è simile a stat() La funzione è la stessa, l'unica differenza è che se file Se il parametro è un collegamento simbolico, viene restituito lo stato del collegamento simbolico, non lo stato del file al quale il collegamento simbolico punta.

Commento:Il risultato di questa funzione viene cacheato. Utilizzare clearstatcache() per pulire la cache.

Esempio

<?php
print_r(lstat("test.txt"));
?>

Output simile a:

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
)