[英]How To Return a Http Response Status Code in Laravel response()->download()?
每个人! 我有这段代码将下载一个存在于我的public
目录中的文件。
$headers = [
'Content-Type: application/pdf',
];
return response()->download($file, $fileName, $headers);
$file
变量包含 pdf 文件的public_path()
。 在我的前端,我用 Axios 调用这个方法。 文件下载成功,但在浏览器控制台中出现此错误。
GET http://192.168.100.12:9000/api/v1/price-update/download net::ERR_BLOCKED_BY_CLIENT
我认为这是因为响应没有返回200
Http 响应代码。
请问有人能解决这个问题吗?
提前致谢
响应(200)->下载($file, $fileName, $headers);
响应(200)->下载($file, $fileName, $headers);
这会抛出Method Illuminate\\Http\\Response::download does not exist.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.