Reference for setting csv file headers generated by php

Source: Internet
Author: User
Reference for setting csv file headers generated by php

  1. $ CsvContent = "qwe, qwe/n ";
  2. Header ("Content-Type: application/vnd. ms-excel; charset = GB2312 ");
  3. Header ("Pragma: public ");
  4. Header ("Expires: 0 ");
  5. Header ("Cache-Control: must-revalidate, post-check = 0, pre-check = 0 ");
  6. Header ("Content-Type: application/force-download ");
  7. Header ("Content-Type: application/octet-stream ");
  8. Header ("Content-Type: application/download ");
  9. Header ("Content-Disposition: attachment?filename=csvdata .csv ");
  10. Header ("Content-Transfer-Encoding: binary ");
  11. $ CsvContent = iconv ("UTF-8", "gb2312", $ csvContent );
  12. Echo $ csvContent;
  13. Exit;
  14. ?>

For more information, see: PHP header function usage example php header function usage example (2) php header function usage example (1) example of the header function usage in php: php header usage description: php header information application example: php generate csv file

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.