Ask a question about exporting data in PHPExcel

Source: Internet
Author: User
Ask a question about how to export data in PHPExcel on a small website developed on the local machine, use PHPExcel to export data to excel, the test is normal. But when I copy all the programs to the server, the problem arises. Originally, the data could be imported and the data could not be exported. The key is that the save file dialog box does not pop up and the data is directly output to the webpage. I have been searching for a long time and don't know why!
Export data on the local machine. normal:

After the program is copied to the server, the "save" dialog box is not displayed, but the exported data is directly output to the webpage ,:



This is what happened. after several days, I can't find the cause. I can export data on the local machine. I can also use other computers to browse my local machine and export data normally, which indicates that the code is correct, what settings should be related? has anyone ever encountered this problem? Please give me some advice. thank you!


Reply to discussion (solution)

What is the header? paste it and check it out.

...... Header ('content-Type: application/vnd. ms-excel '); header ("Content-Disposition: attachment; filename = ". "Report_PC ". $ mydate. "_". date ('mdhis '). ". xls "); header ('cache-Control: max-age = 0'); $ objWriter = PHPExcel_IOFactory: createWriter ($ objPHPExcel, 'excel5 '); $ objWriter-> save ('php: // output ');

The header is certainly okay. Today, an error is detected. the server is inconsistent with the apache and php versions on my local machine, and the server is low. Apache2.4.4 + PHP5.4.16, server Apache2.2.11 + PHP5.2.9

If the version is different, check whether some statements are not supported.

Check the compatibility of excle with php apache.

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.