I want to ask why this code is unsuccessful.

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.