yw0421/tp6-filesystem

tp6集成qiniu、oss、cos上传

维护者

详细信息

gitee.com/yw0421/tp6-filesystem.git

安装: 57

依赖: 0

建议者: 0

安全: 0

v1.0 2022-02-08 13:12 UTC

This package is auto-updated.

Last update: 2024-09-08 19:58:36 UTC


README

tp6集成qiniu、oss、cos上传

使用方法

composer require yw0421/tp6-filesystem

在config/filesystem.php中添加对应的驱动配置

return [
    "default" => "qiniu",
    "disks" => [
        "public" => [
            "type" => "local",
            "root" => ".",
            "visibility" => "public",
            "domain" => ""
        ],
        "qiniu" => [
            "type" => "qiniu",
            "accessKey" => "",
            "secretKey" => "",
            "bucket" => "",
            "domain" => ""
        ],
        "oss" => [
            "type" => "oss",
            "accessId" => "",
            "accessSecret" => "",
            "bucket" => "",
            "endpoint" => "",
            "domain" => ""
        ],
        "cos" => [
            "type" => "cos",
            "region" => "ap-guangzhou",
            "credentials" => [
                "appId" => "",
                "secretId" => "",
                "secretKey" => ""
            ],
            "bucket" => "",
            "domain" => "",
            "scheme" => "http"
        ]
    ]
];

上传

$file = $this->request->file('file');
\think\facade\Filesystem::disk('oss')->putFile('upload', $file);

删除

\think\facade\Filesystem::disk('oss')->delete($path);

更详细的用法请参考Adapter对应的文件