Reference for setting csv file headers generated by php
- $ CsvContent = "qwe, qwe/n ";
- Header ("Content-Type: application/vnd. ms-excel; charset = GB2312 ");
- Header ("Pragma: public ");
- Header ("Expires: 0 ");
- Header ("Cache-Control: must-revalidate, post-check = 0, pre-check = 0 ");
- Header ("Content-Type: application/force-download ");
- Header ("Content-Type: application/octet-stream ");
- Header ("Content-Type: application/download ");
- Header ("Content-Disposition: attachment?filename=csvdata .csv ");
- Header ("Content-Transfer-Encoding: binary ");
- $ CsvContent = iconv ("UTF-8", "gb2312", $ csvContent );
- Echo $ csvContent;
- Exit;
- ?>
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 |