PHP lstat() 函数

PHP 教程 · 2019-01-25 12:29:12

定义和用法

lstat() 函数返回关于文件或符号连接的信息。

该函数将返回一个包含下列元素的数组:

  • [0] 或 [dev] - 设备编号
  • [1] 或 [ino] - inode 编号
  • [2] 或 [mode] - inode 保护模式
  • [3] 或 [nlink] - 连接数目
  • [4] 或 [uid] - 所有者的用户 ID
  • [5] 或 [gid] - 所有者的组 ID
  • [6] 或 [rdev] - inode 设备类型
  • [7] 或 [size] - 文件大小的字节数
  • [8] 或 [atime] - 上次访问时间(Unix 时间戳)
  • [9] 或 [mtime] - 上次修改时间(Unix 时间戳)
  • [10] 或 [ctime] - 上次 inode 改变时间(Unix 时间戳)
  • [11] 或 [blksize] - 文件系统 IO 的块大小(如果支持)
  • [12] 或 [blocks] - 所占据块的数目

语法


lstat(file)


参数 描述
file 必需。规定要检查的路径。

提示和注释

注释:从这个函数返回的结果与服务器到服务器的结果是不相同的。这个数组包含了数字索引、名称索引或同时包含上述二者。

注释:该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。

提示:lstat() 函数与 stat() 函数大致类似。唯一的不同点就是,如果 file 参数是一个符号连接,那么将返回该符号连接的状态(而不是该符号连接所指向的文件的状态)。

实例


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

上面的代码将输出:


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
) 


点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

GWT in Action

GWT in Action

Robert Hanson、Adam Tacy / Manning Publications / 2007-06-05 / USD 49.99

This book will show Java developers how to use the Google Web Toolkit (GWT) to rapidly create rich web-based applications using their existing skills. It will cover the full development cycle, from ......一起来看看 《GWT in Action》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具