twistor / flysystem-http
Flysystem 的 HTTP 适配器,使用基本的 PHP 函数。
0.2.0
2016-11-19 00:21 UTC
Requires
- league/flysystem: ^1.0.20
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2024-08-26 09:04:55 UTC
README
此适配器使用基本的 PHP 函数访问 HTTP 资源。它是只读的。
安装
composer require twistor/flysystem-http
使用方法
use League\Flysystem\Filesystem; use Twistor\Flysystem\Http\HttpAdapter; $filesystem = new Filesystem(new HttpAdapter('http://example.com')); $contents = $filesystem->read('file.txt');
默认情况下,将通过 HEAD 请求检索元数据。这可以禁用。
use Twistor\Flysystem\Http\HttpAdapter; $supportsHead = false; $adapter = new HttpAdapter('http://example.com', $supportsHead);
可以使用第三个参数设置 PHP 上下文选项。
use Twistor\Flysystem\Http\HttpAdapter; $context = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, ], ]; $adapter = new HttpAdapter('http://example.com', true, $context);