-
- $csvContent = "qwe,qwe,qwe,qwe,qwe,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=CSV data.csv ");
- header("Content-Transfer-Encoding: binary ");
- $csvContent = iconv("utf-8","gb2312",$csvContent);
- echo $csvContent;
- exit;
- ?>
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
|