PHP;">
PHP
header("Content-type:text/csv;charset=utf-8");
header("Content-Disposition:attachment;filename=aa.csv");
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Expires:0');
header('Pragma:public');
$data = "\xEF\xBB\xBFaaaaa\tbbbbb\tccccc\n11111\t222222\t33333"; // \xEF\xBB\xBF是bom头
$data = iconv('utf-8','ucs-2',$data);
echo $data;
PHP;">
PHP
header("Content-type:text/csv;charset=utf-8");
header("Content-Disposition:attachment;filename=aa.csv");
header('Cache-Control:must-revalidate,pre-check=0');
header('Expires:0');
header('Pragma:public');
$data = "aaaaa,bbbbb,ccccc\n11111,222222,33333";
$data = iconv('utf-8','gbk',$data);
echo $data;
以上所述是小编给大家介绍的PHP 生成Tab键或逗号分隔的CSV。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持。
原文链接:https://www.f2er.com/php/18954.html