config.php 2.6 KB
<?php

return [
    /**
     * 图片上传配置
     */
    'upload_img' => [
        //验证
        'rule' => [
            'size' => 3 * 1024 * 1024, //大小限制
            'ext' => 'jpeg,jpg,png,gif', //文件类型限制
        ],
        //生成文件规则
        'savename' => 'uniqid',
        //缩略图缓存路径(可删除)
        'cache' => ROOT_PATH . 'runtime/images/',
        //设置静态缓存参数(304)
        'header_cache' => [
            'Cache-Control' => 'max-age=2592000',
            'Pragma' => 'cache',
            'Expires' => "%Expires%", // cache 1 month
            'etag' => "%etag%",
            'Last-Modified' => "%Last-Modified%",
            'Content-Description' => 'File Transfer',
        ],
        //图片保存根路径
        'path' => './uploads/images/',
        //图片上传变量名
        'name' => 'image',
    ],
    /**
     * 文件上传配置
     */
    'upload_file' => [
        //验证
        'rule' => [
            'size' => 50 * 1024 * 1024, //大小限制
        ],
        'cache' => ROOT_PATH . 'runtime/file/',
        //生成文件规则
        'savename' => 'uniqid',
        'header_cache' => [
            'Accept-Ranges' => 'bytes',
            'Cache-Control' => 'public',
            'Pragma' => 'cache',
            'Expires' => "%Expires%", // cache 1 month
            'etag' => "%etag%",
            'Last-Modified' => "%Last-Modified%",
        ],
        //文件保存根路径
        'path' => './uploads/files/',
        //文件上传变量名
        'name' => 'file',
        //压缩文件临时保存根路径
        'temp_path' => ROOT_PATH . 'runtime/file/',
        //mime限制
//        'mime_type' => ['video/x-ms-asf', 'application/octet-stream', 'audio/mp4', 'audio/x-flac', 'audio/mpeg', 'audio/x-wav'],
    ],
    /**
     * 文件上传配置
     */
    'upload_audio' => [
        //验证
        'rule' => [
            'size' => 50 * 1024 * 1024, //大小限制
        ],
        'cache' => ROOT_PATH . 'runtime/file/',
        //生成文件规则
        'savename' => 'uniqid',
        'header_cache' => [
            'Accept-Ranges' => 'bytes',
            'Cache-Control' => 'public',
            'Pragma' => 'cache',
            'Expires' => "%Expires%", // cache 1 month
            'etag' => "%etag%",
            'Last-Modified' => "%Last-Modified%",
        ],
        //文件保存根路径
        'path' => './uploads/files/',
        //文件上传变量名
        'name' => 'file',
        //压缩文件临时保存根路径
        'temp_path' => ROOT_PATH . 'runtime/file/',

    ],
];