[英]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.