首页  >  文章  >  后端开发  >  php生成csv文件header设置参考

php生成csv文件header设置参考

WBOY
WBOY原创
2016-07-25 08:55:091474浏览
  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数据.csv ");
  10. header("Content-Transfer-Encoding: binary ");
  11. $csvContent = iconv("utf-8","gb2312",$csvContent);
  12. echo $csvContent;
  13. exit;
  14. ?>
复制代码

更多内容,请参考: PHP header函数用法举例 php header函数用法详解举例(2) php header函数用法举例(1) php中header函数的用法举例详解 php header 使用详解 php header头信息应用举例 php生成csv文件



声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn