php 生成Tab键或逗号分隔的CSV
php 生成Tab键或逗号分隔的CSV的代码如下所示:
<?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 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 = "aaaaa,bbbbb,ccccc\n11111,222222,33333"; $data = iconv('utf-8', 'gbk', $data); echo $data;
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23