johnnycai/tp6-filesystem-cloud
Composer 安装命令:
composer require johnnycai/tp6-filesystem-cloud
包简介
thinkphp6 filesystem cloud support,include Aliyun,Qcloud and Qiniu.
README 文档
README
ThinkPHP6 的Filesystem扩展包,支持上传到阿里云、腾讯云、七牛云、华为云
使用方法
安装
composer require johnnycai/tp6-filesystem-cloud
在config/filesystem.php中增加对应驱动配置
return [ "default" => "oss", "disks" => [ "public" => [ "type" => "local", "root" => ".", "visibility" => "public", "domain" => "" ], // 阿里云配置 "oss" => [ "type" => "oss", 'prefix' => '',// 前缀,非必填 "accessKeyId" => "", "accessKeySecret" => "", "endpoint" => "", "bucket" => "", "domain" => "" ], // 七牛云配置 "qiniu" => [ "type" => "qiniu", "accessKey" => "", "secretKey" => "", "bucket" => "", "domain" => "" ], // 腾讯云配置 "cos" => [ "type" => "cos", "region" => "ap-guangzhou", "credentials" => [ "appId" => "", "secretId" => "", "secretKey" => "" ], "bucket" => "", "domain" => "", "scheme" => "https", 'encrypt'=> false, ], // 华为云配置 "obs" => [ "type" => "obs", "accessKey" => "", "secretKey" => "", "endpoint" => "", "bucket" => "", "domain" => "" ], ] ];
用法
上传
$file = $this->request->file('file'); \think\facade\Filesystem::disk('oss')->putFile('upload', $file);
删除
\think\facade\Filesystem::disk('oss')->delete($path);
更新
\think\facade\Filesystem::disk('oss')->update($path);
重命名
\think\facade\Filesystem::disk('oss')->rename($path,$newpath);
创建文件夹
\think\facade\Filesystem::disk('oss')->createDir($dirname);
删除文件夹
\think\facade\Filesystem::disk('oss')->createDir($dirname);
更详细用法参考Adapter对应文件
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-15