gumphp / think-filesystem
v1.0.2
2023-06-01 07:49 UTC
Requires
- league/flysystem-aws-s3-v3: ^v2.5
- topthink/framework: ^v6.1
- topthink/think-filesystem: ^v2.0
This package is auto-updated.
Last update: 2024-11-30 02:44:22 UTC
README
composer require gumphp/think-filesystem:dev-master
配置
# config/filesystem.php <?php return [ // 默认磁盘 'default' => env('filesystem.driver', 'aws'), // 磁盘列表 'disks' => [ // 更多的磁盘配置信息 'aws' => [ 'type' => 'aws', 'credentials' => [ 'key' => env('AWS.S3_KEY', ''), 'secret' => env('AWS.S3_SECRET', ''), ], 'version' => env('AWS.S3_VERSION', 'latest'), 'region' => env('AWS.S3_REGION', 'us-west-2'), 'bucket' => env('AWS.S3_BUCKET', ''), 'prefix' => '/', ], ], ];
使用
<?php namespace app\controller; use think\facade\Filesystem; class Index { public function index() { Filesystem::disk('aws')->put('/s3/remote/file.ext', file_get_contents('/path/yourfile.ext')); } }