laravel下载文件

朱宜
2023-12-01

public function jobDownload(){
$realPath = public_path('download/job/postForm.xls');
$filename = '应聘表格.xls';
$headers=[
"Content-Disposition"=>"attachment; filename=".$filename,
"Content-Transfer-Encoding"=>" binary",
"Content-Type"=>" application/xls"
];

return response()->download($realPath,$filename,$headers);
}

黄色部分,文件真实名一定要用中文,否则找不到文件!

转载于:https://www.cnblogs.com/caicaizi/p/6646722.html

 类似资料: