欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

生成csv文件的header的设置

程序员文章站 2024-01-24 09:55:40
...
01 02 $csvContent = "qwe,qwe,qwe,qwe,qwe,qwe,qwe \n";
03 header("Content-Type: application/vnd.ms-excel; charset=GB2312");
04 header("Pragma: public");
05 header("Expires: 0");
06 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
07 header("Content-Type: application/force-download");
08 header("Content-Type: application/octet-stream");
09 header("Content-Type: application/download");
10 header("Content-Disposition: attachment;filename=CSV数据.csv ");
11 header("Content-Transfer-Encoding: binary ");
12 $csvContent = iconv("utf-8","gb2312",$csvContent);
13 echo $csvContent;
14 exit;
15 ?>

作者:张大鹏