lstat()
(PHP 4, PHP 5, PHP 7)
给出一个文件或符号连接的信息
说明
lstat(string $filename): array
获取由$filename指定的文件或符号连接的统计信息。
参数
- $filename
文件或符号连接的路径。
返回值
有关lstat()返回的数组结构见手册中stat()函数的页面。本函数和stat()函数相同,只除了如果$filename参数是符号连接的话,则该符号连接的状态被返回,而不是该符号连接所指向的文件的状态。
范例
Example #1stat()和lstat()的对照
<?php symlink('uploads.php', 'uploads'); // Contrast information for uploads.php and uploads array_diff(stat('uploads'), lstat('uploads')); ?>
以上例程的输出类似于:
Information that differs between the two files.
Array ( [ino] => 97236376 [mode] => 33188 [size] => 34 [atime] => 1223580003 [mtime] => 1223581848 [ctime] => 1223581848 [blocks] => 8 )
错误/异常
失败时抛出E_WARNING
警告。
注释
TipNote:此函数的结果会被缓存。参见clearstatcache()以获得更多细节。
自 PHP 5.0.0 起,此函数也用于某些URL 包装器。请参见支持的协议和封装协议以获得支持stat()系列函数功能的包装器列表。
参见
stat()
给出文件的信息
This function fails and returns FALSE with files larger than 2 GB on Linux 32-bits (PHP 7.1.0-dev): $ dd if=/dev/zero of=/tmp/huge bs=1048576 count=2050 $ php -r 'var_dump(lstat("/tmp/huge"));' --> Warning: lstat(): Lstat failed for /tmp/huge in Command line code on line 1 Window not tested. PHP 64-bits not tested.