Laravel部署后如何修改文件上传路径为自定义路径?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1031个文字,预计阅读时间需要5分钟。
phpfunction storage_path(){ return base_path('storage');}
常见错误是直接在 config/filesystems.php 里改 'root' => storage_path('app') 这一行,以为改了这里就全局生效。其实这只是影响 Storage 门面的默认磁盘行为,request()->file()->store() 等上传方法仍可能走默认配置或硬编码路径。
本文共计1031个文字,预计阅读时间需要5分钟。
phpfunction storage_path(){ return base_path('storage');}
常见错误是直接在 config/filesystems.php 里改 'root' => storage_path('app') 这一行,以为改了这里就全局生效。其实这只是影响 Storage 门面的默认磁盘行为,request()->file()->store() 等上传方法仍可能走默认配置或硬编码路径。

