php 生成Tab键或逗号分隔的CSV的代码如下所示:
<"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 = "xEFxBBxBFaaaaatbbbbbtcccccn11111t222222t33333"; // xEFxBBxBF是bom头 $data = iconv('utf-8', 'ucs-2', $data); echo $data;
<"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 = "aaaaa,bbbbb,cccccn11111,222222,33333"; $data = iconv('utf-8', 'gbk', $data); echo $data;
以上所述是小编给大家介绍的php 生成Tab键或逗号分隔的CSV,希望对大家有所帮助,如果大家有任何疑问请给我们留言,小编会及时回复大家的。在此也非常感谢大家对查字典教程网的支持!