ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
>[danger] 多文件上传 ``` <form action="{:url('index/upload')}" enctype="multipart/form-data" method="post"> <input type="file" name="image[]" /> <br> <input type="file" name="image[]" /> <br> <input type="submit" value="上传" /> </form> ``` ```php public function upload() { // 获取表单上传文件 // 数组对象 [对象1, 对象2, ...] $files = request()->file('image'); $savename = []; foreach($files as $file){ $savename[] = \think\facade\Filesystem::putFile('topic', $file); } /** array(3) { [0]=> string(52) "topic/20200131\fd9a546c5a7c2cf36d43fe76f520bf1c.jpeg" [1]=> string(51) "topic/20200131\00f446e1e4d501a7e1f3d6b2fef6ef34.jpg" } */ var_dump($savename); } ```