折叠 编辑本段 定义和用法
fstat(由文件描述360百科词取得文件状态)
相关函数 stat,lstat,chmod,chown,readlink,utim规哥拿治谓宽纸笑e
表头文件 #include<sys/stat.h>
#include<unistd.h>
定义函数 int fstat(int fildes,struct stat *buf);
函数说明 fstat()用来将参数fi父深领一ldes所指的文件月知夜据皮存状态,复制到参数buf所指的
结构中(struct sta这诉备迫责子甲机适t)。Fstat()与stat()作用完全相同,不同处在
于传入的参数为已打开的文件描述词。详细内容请参京沉影考stat()。
返回值 执行成功则返回0,失败返回-1,错误代码存于errno。
折叠 编辑本段 语法
fstat(file) |
参数 | 描述 |
pipe | 必需。规定要检师演查的打开文件。 |
折叠 编辑本段 说明
折叠 编辑本段 提示和注释
提示:本函数与 stat() 函数相似,不同的是,它是作用于已打开的文件脚坏激架四长联氧药指针而不是文件名。
折含质味料础曲极措叠 编辑本段 例子
<?php
$持职句结息念多包第城file = fopen(哥绍成散手严神"test.txt","r");
print_r(fs犯究束还关控春听住似tat($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] => 114整建万素判晶从明难1633430 [mtime] => 1141298003 [ctime] => 1138609592 [blksize] => -1 [blocks] => -1 )
PHP Filesystem 函数