The code for PHP to generate the TAB key or comma-separated CSV is as follows:
<?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 is the BOM header
$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;
The above is a small set of PHP to introduce you to generate the TAB key or comma-separated csv, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!