php-extended / php-file-object
实现php-extended/php-file-interface接口库的库。
7.0.7
2024-07-31 13:52 UTC
Requires
- php: >=8.0
- php-extended/php-file-interface: ^7
Requires (Dev)
- dev-master
- 7.0.7
- 7.0.6
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.1.7
- 6.1.6
- 6.1.5
- 6.1.4
- 6.1.3
- 6.1.2
- 6.1.1
- 6.1.0
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.2
- 4.0.1
- 4.0.0
- 3.1.24
- 3.1.23
- 3.1.22
- 3.1.21
- 3.1.20
- 3.1.19
- 3.1.18
- 3.1.17
- 3.1.16
- 3.1.15
- 3.1.14
- 3.1.13
- 3.1.12
- 3.1.11
- 3.1.10
- 3.1.9
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.0
This package is auto-updated.
Last update: 2024-08-31 12:04:15 UTC
README
实现php-extended/php-file-interface接口库的库。
安装
此库的安装通过composer完成,并且通过其自动加载器加载此库的所有类。
- 从他们的网站下载
composer.phar
。 - 然后运行以下命令将此库作为依赖项安装
php composer.phar php-extended/php-file-object ^7
基本用法
使用时,您应该首先使用给定的绝对路径实例化一个文件系统,该文件系统将用于在(虚拟)文件系统中chroot
给定的文件。然后,将使用文件系统对象的getFolder
和getFile
方法添加每个文件或文件夹。
use PhpExtended\Filesystem;
/* @var $fs \PhpExtended\File\FileSystem */
$fs = new Filesystem('/dev'); // absolute path from the real fs
/* @var $file \PhpExtended\File\File */
$file = $fs->getFile('random'); // path relative to the virtual fs
/* @var $stream \PhpExtened\File\FileStream */
$stream = $fs->getDataStream();
/* @var $data string */
$data = $stream->read(128); // 128 bytes read from /dev/random
许可证
MIT (见许可证文件)。