Files
tfm-oss/config_oss_example.php
T
2025-11-26 05:24:49 +00:00

103 lines
3.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 阿里云 OSS 配置示例
*
* 将此文件重命名为 config.php 并放在 Tiny File Manager 同一目录下
* 该文件将覆盖 myfile.php 中的默认配置
*/
// ========== 阿里云 OSS 配置 ==========
// 启用阿里云 OSS 支持
$use_aliyun_oss = false; // 设置为 true 启用 OSSfalse 使用本地文件系统
// 阿里云 OSS 配置信息
$oss_config = array(
// 【必填】阿里云 AccessKeyId
'access_key_id' => 'YOUR_ACCESS_KEY_ID',
// 【必填】阿里云 AccessKeySecret
'access_key_secret' => 'YOUR_ACCESS_KEY_SECRET',
// 【必填】OSS Endpoint(根据你的 bucket 区域选择)
// 常用区域:
// - 华东1(杭州):oss-cn-hangzhou.aliyuncs.com
// - 华东2(上海):oss-cn-shanghai.aliyuncs.com
// - 华北1(青岛):oss-cn-qingdao.aliyuncs.com
// - 华北2(北京):oss-cn-beijing.aliyuncs.com
// - 华南1(深圳):oss-cn-shenzhen.aliyuncs.com
'endpoint' => 'oss-cn-hangzhou.aliyuncs.com',
// 【必填】OSS Bucket 名称
'bucket' => 'your-bucket-name',
// 【可选】是否使用内网 endpoint(适用于阿里云 ECS
// 设置为 true 会自动将 endpoint 转换为内网地址
// 例如:oss-cn-hangzhou.aliyuncs.com -> oss-cn-hangzhou-internal.aliyuncs.com
'use_internal' => false,
// 【可选】是否使用 HTTPS(推荐开启)
'use_ssl' => true,
// 【可选】OSS 文件路径前缀
// 例如设置为 'filemanager/',则所有文件都会存储在 bucket 的 filemanager/ 目录下
'prefix' => '',
// 【可选】自定义访问域名
// 如果你的 bucket 绑定了自定义域名,请在这里填写
// 例如:'cdn.yourdomain.com' 或 'files.yourdomain.com'
// 留空则使用 OSS 默认域名
'custom_domain' => '',
);
// OSS SDK 自动加载路径
// 如果使用 Composer 安装,通常无需修改
$oss_sdk_path = __DIR__ . '/vendor/autoload.php';
// ========== 其他 Tiny File Manager 配置 ==========
// 认证用户(用户名 => 密码哈希)
// 生成密码哈希:https://tinyfilemanager.github.io/docs/pwd.html
$auth_users = array(
'admin' => '$2y$10$8qIYdh84LSOVzngfLEXWse6wJdJtdzxOyn2I3xRCiUtaLx9ccLCHe', // 密码:admin@123
'user' => '$2y$10$8qIYdh84LSOVzngfLEXWse6wJdJtdzxOyn2I3xRCiUtaLx9ccLCHe' // 密码:12345
);
// 只读用户列表
$readonly_users = array(
'user'
);
// 根路径
// OSS 模式下,此配置可能不生效,文件操作将直接在 OSS bucket 中进行
$root_path = $_SERVER['DOCUMENT_ROOT'];
// 最大上传文件大小(字节)
$max_upload_size_bytes = 5000000000; // 5GB
// 上传分块大小(字节)
$upload_chunk_size_bytes = 2000000; // 2MB
// 时区设置
$default_timezone = 'Asia/Shanghai'; // 中国时区
// 日期时间格式
$datetime_format = 'Y-m-d H:i:s';
// 允许上传的文件扩展名(留空表示允许所有)
// 例如:'jpg,png,gif,pdf,zip'
$allowed_upload_extensions = '';
// 排除的文件和文件夹
// 例如:array('config.php', '.git', 'vendor')
$exclude_items = array();
// 在线文档查看器
// 'google' - 使用 Google Docs Viewer
// 'microsoft' - 使用 Microsoft Web Apps Viewer
// false - 禁用在线查看
$online_viewer = 'google';
?>