In the previous project, we found that PHPHeader was used to forcibly download the Chinese garbled characters of IE file names. this is a certain browser, which everyone knows... & Amp; nbsp; solution: (my page is UTF-8 encoded): Invalid filename="=chinese .txt
I found that the PHP Header was used in the previous project to forcibly download the Chinese garbled characters of the IE file name. this is a certain browser, which everyone knows...
The solution is as follows (my page is UTF-8 encoded ):
$ Filename = ".txt 文.txt"; $ ua = $ _ SERVER ["HTTP_USER_AGENT"]; $ encoded_filename = urlencode ($ filename); $ encoded_filename = str_replace ("+ ", "% 20", $ encoded_filename); header ('content-Type: application/octet-stream'); if (preg_match ("/MSIE/", $ ua )) {header ('content-Disposition: attachment; filename = "'. $ encoded_filename. '"');} else if (preg_match ("/Firefox/", $ ua) {header ('content-Disposition: attachment; filename * = "utf8 \'\''. $ filename. '"');} else {header ('content-Disposition: attachment; filename = "'. $ filename. '"');}