ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
>[danger] 文件磁盘配置: 定义文件上传时的上传规则 ``` 全局配置文件(文件磁盘配置文件): config/filesystem.php ``` ```php return [ // 默认磁盘 'default' => env('filesystem.driver', 'local'), // 磁盘列表 'disks' => [ 'local' => [ 'type' => 'local', 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ // 磁盘类型 'type' => 'local', // 磁盘路径 'root' => app()->getRootPath() . 'public/storage', // 磁盘路径对应的外部URL路径 'url' => '/storage', // 可见性 'visibility' => 'public', ], // 更多的磁盘配置信息 ], ]; ``` >[danger] `default` 默认磁盘配置 #### 用于设置默认的磁盘,没有指定磁盘时的默认磁盘 ``` $savename = \think\facade\Filesystem::putFile( 'topic', $file); ``` >[danger] `disks` 磁盘配置列表 + local    是第一个磁盘配置的配置名 + public  是第二个磁盘配置的配置名 ``` // 上传到本地服务器 $savename = \think\facade\Filesystem::disk('磁盘名')->putFile( 'topic', $file); 示例: $savename = \think\facade\Filesystem::disk('public')->putFile( 'topic', $file); ```