Files
YwxAppThink/config/filesystem.php
T

80 lines
3.3 KiB
PHP

<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-04-29 02:32:33
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-07-27 23:19:05
* @Description:
* @FilePath: \ywxapp_dev\config\filesystem.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
// config/filesystem.php
return [
// 默认存储方式
'default' => 'local', // 这里可以切换为 'aliyun', 'cos', 'qiniu' 等
// 存储驱动配置
'disks' => [
// 本地存储(默认)
'local' => [
'type' => 'local',
'class' => 'ywxapp\utils\storage\LocalStorage',
'root' => app()->getRootPath() . 'public/storage',
'url' => request()->domain() . '/storage',
'visibility' => 'public',
],
'runtime' => [
'type' => 'local',
'root' => app()->getRootPath().'runtime',
],
// 示例:阿里云 OSS
'aliyun' => [
'type' => 'filesystem', // 使用Flysystem驱动
'class' => \League\Flysystem\Aliyun\AliyunOssAdapter::class,
'config' => [
'accessKeyId' => 'your-access-key-id', // 你的AccessKeyId
'accessKeySecret' => 'your-access-key-secret', // 你的AccessKeySecret
'endpoint' => 'https://oss-your-region.aliyuncs.com', // 端点
'bucket' => 'your-bucket-name', // 存储空间
'prefix' => '', // 文件路径前缀(可选)
],
],
// 示例:腾讯云 COS
'cos' => [
'type' => 'filesystem', // 使用Flysystem驱动
'class' => \League\Flysystem\Cos\CosAdapter::class,
'config' => [
'region' => 'ap-guangzhou', // 区域
'credentials' => [
'secretId' => 'your-secret-id', // SecretId
'secretKey' => 'your-secret-key', // SecretKey
],
'bucket' => 'your-bucket-name', // 存储桶
'endpoint' => 'https://cos.your-region.myqcloud.com', // 备用endpoint(可选)
],
],
// 示例:七牛云 Qiniu
'qiniu' => [
'type' => 'filesystem', // 使用Flysystem驱动
'class' => \League\Flysystem\Qiniu\QiniuAdapter::class,
'config' => [
'accessKey' => 'your-access-key', // AccessKey
'secretKey' => 'your-secret-key', // SecretKey
'bucket' => 'your-bucket', // 存储空间
'domain' => 'your-domain.com', // 绑定域名
'zone' => 'zone0', // 区域
],
],
],
];