Axios download excel file cannot be opened

Project requirements, download reports of excel file type, post request, and the backend returns to me in the form of file stream. I first judge the type of response header, such as excel file, and dynamically create an a tag to get the file. The code is as follows!

a
post

the result is that the file is downloaded, but it can"t be opened. I don"t know why

Mar.18,2021

Let me tell you a problem I encountered the day before yesterday
scenario:

header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="export.csv"');
$header = array('ID', '...', '...');

//echo content

...
At that time, the scene in the backend is like this. The header of the output has a capital "ID". As a result, downloading and opening the file under windows always prompts you to report an error, and then checks the content all the time. A little bit of debugging will find this problem. Just modify the "ID". So I'll give you some ideas.


and communicate with the background to provide a download connection through streaming. Click download

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e417cd-435f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e417cd-435f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?