stat

(PHP 3, PHP 4 )

stat -- 给出文件的信息

说明

array stat ( string filename)

获取由 filename 指定的文件的统计信息。如果 filename 是符号连接,则统计信息是关于被连接文件本身的,而不是符号连接。lstat()stat() 相同,只除了它会返回符号连接的状态。

如果出错,stat() 返回 FALSE

返回一个数组包含有文件的统计信息。该数组具有以下单元:

  1. device - 设备名

  2. inode - 节点名

  3. inode protection mode - 节点保护模式

  4. number of links - 连接数目

  5. user id of owner - 所有者的用户 id

  6. group id owner - 所有者的组 id

  7. device type if inode device *

  8. size in bytes - 文件大小的字节数

  9. time of last access - 上一次被访问时间

  10. time of last modification - 上一次被修改时间

  11. time of last change - 上一次改变时间

  12. blocksize for filesystem I/O *

  13. number of blocks allocated - 所分配块的数目

* - 仅在支持 st_blksize 类型的系统下有效。其它系统(如 Windows)返回 -1。

注: 本函数的结果会被缓存。详细信息参见 clearstatcache()

注: 本函数不能作用于远程文件,被检查的文件必须通过服务器的文件系统访问。

参见 lstat()filemtime()filegroup()