略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: eio_statvfs

2024-11-13

eio_statvfs

(PECL eio >= 0.0.1dev)

eio_statvfsGet file system statistics

说明

eio_statvfs(
    string $path,
    int $pri,
    callable $callback,
    mixed $data = ?
): resource

eio_statvfs() returns file system statistics information in result argument of callback

参数

path

Pathname of any file within the mounted file system

pri

请求的优先级:EIO_PRI_DEFAULTEIO_PRI_MINEIO_PRI_MAXnull。如果是 nullpri 将设为 EIO_PRI_DEFAULT

callback

callback 函数在请求完成时被调用。其应匹配一下原型:

void callback(mixed $data, int $result[, resource $req]);
data

传递给请求的用户数据。

result

针对请求的结果的值。通常是相应的系统调用返回的值。

req

可选的请求资源,可被 eio_get_last_error() 之类的函数使用。

data

Arbitrary variable passed to callback.

返回值

eio_statvfs() returns request resource on success, 或者在失败时返回 false. On success assigns result argument of callback to an array.

范例

示例 #1 eio_statvfs() example

<?php
$tmp_filename 
'/tmp/eio-file.tmp';
touch($tmp_filename);

function 
my_statvfs_callback($data$result) {
    
var_dump($data);
    
var_dump($result);

 @
unlink($data);
}

eio_statvfs($tmp_filenameEIO_PRI_DEFAULT"my_statvfs_callback"$tmp_filename);
eio_event_loop();
?>

以上例程的输出类似于:

string(17) "/tmp/eio-file.tmp"
array(11) {
  ["f_bsize"]=>
  int(4096)
  ["f_frsize"]=>
  int(4096)
  ["f_blocks"]=>
  int(262144)
  ["f_bfree"]=>
  int(262111)
  ["f_bavail"]=>
  int(262111)
  ["f_files"]=>
  int(1540815)
  ["f_ffree"]=>
  int(1540743)
  ["f_favail"]=>
  int(1540743)
  ["f_fsid"]=>
  int(0)
  ["f_flag"]=>
  int(4102)
  ["f_namemax"]=>
  int(255)
}
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.eio-statvfs.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3