Home  >  Article  >  Backend Development  >  PHP generates csv file header setting reference

PHP generates csv file header setting reference

WBOY
WBOYOriginal
2016-07-25 08:55:091474browse
  1. $csvContent = "qwe,qwe,qwe,qwe,qwe,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=CSV data.csv ");
  10. header("Content-Transfer-Encoding: binary ");
  11. $csvContent = iconv("utf-8","gb2312",$csvContent);
  12. echo $csvContent;
  13. exit;
  14. ?>
Copy code

For more information, please refer to: PHP header function usage example php header function usage detailed example (2) php header function usage example (1) Detailed explanation of usage examples of header function in php Detailed explanation of php header usage php header information application example php generate csv file



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn