uploadFile($request->file('file')); if($status){ return $this->json_return(200,'上传成功',['url' => $data]); }else{ return $this->json_return(201,$data); } } //获取文件的位置 public function getFile($file_name){ $path = storage_path() . "/app/public/upload_files/".$file_name; // $ext = ''; // foreach (FileUploadService::FILE_TYPE as $value){ // if(file_exists($path. '.' . $value)){ // $ext = $value; // } // } // if(empty($ext)) return ''; .'.'.$ext return response()->file($path); } }