I want to ask why this code is unsuccessful.
The Download box is not displayed, but a bunch of garbled characters are printed directly. (Is it estimated that readfile is directly read to the screen ?)
Thank you!
Reply to discussion (solution)
Garbled? Is the file a Chinese name?
Add
Header ("Content-type: text/html; charset = GB2312 ");
Or
Header ("Content-type: text/html; charset = GBK ");
Post it!
Apparently, it is a syntax error.
Post it!
Apparently, it is a syntax error.
Sorry forgot to map.
Click here. Click the download link of New Document(2).txt. Jump to the php in the code you just pasted:
The result is that the txt file is opened in the browser instead of downloaded.
Why...
ob_clean();flush();
Remove the two.
ob_clean();flush();
Remove the two.
Thank you! The last reason is that I wrote it from the second line. An error is reported.
It seems that the details are sloppy!