Php encountered a problem downloading the file

when I downloaded the zip file in the background, I wrote the necessary parameters in the header, but still did not appear the download box, but appeared in the return value. Can anyone tell me ~
Sorry, the response of the laravel used to download the code

.

this is my header:


$headers = [
                    "Content-type"=>"application/octet-stream",
                    "Content-Disposition"=>"attachment;filename=".$filename,
                    "Accept-Length"=>filesize($local_path."\\".$filename),
                    "Content-Transfer-Encoding"=>"binary"
                ];
return response()->download($local_path."\\".$filename,$filename,$headers);

the result returned after download,

but the strange thing is that if my computer is installed with Thunderbolt, it will automatically jump to Xunlei and download it. If it is not installed, it will be the result above. What is the reason for this?

Apr.07,2021

you should also post the download code instead of just header

then laravel has a response ()-> download () you can use it directly

Menu