PHP fstat() 函数
PHP 教程
· 2019-01-25 08:41:34
定义和用法
fstat() 函数返回关于一个打开的文件的信息。
该函数将返回一个包含下列元素的数组:
- [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] - 所占据块的数目
语法
fstat(file)
| 参数 | 描述 |
|---|---|
| file | 必需。规定要检查的打开文件。 |
提示和注释
注释:从这个函数返回的结果与服务器到服务器的结果是不相同的。这个数组包含了数字索引、名称索引或同时包含上述二者。
提示:fstat() 函数与 stat() 函数大致类似。唯一的不同点就是,fstat()函数在使用时,文件必须已经打开。
实例
<?php
$file = fopen("test.txt","r");
print_r(fstat($file));
fclose($file);
?>
上面的代码将输出:
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://codercto.com/courses/l/5.html
Writing Apache Modules with Perl and C
Lincoln Stein、Doug MacEachern / O'Reilly Media, Inc. / 1999-03 / USD 39.95
Apache is the most popular Web server on the Internet because it is free, reliable, and extensible. The availability of the source code and the modular design of Apache makes it possible to extend Web......一起来看看 《Writing Apache Modules with Perl and C》 这本书的介绍吧!