首页 > Web开发 > 详细

thinkphp csv.class.php文件导出gb2312格式csv

时间:2017-12-07 13:59:56      阅读:340      评论:0      收藏:0      [点我收藏+]
 1 function creatcsv($filename,$array)
 2     {
 3         @ini_set(display_errors,        0);
 4         header("Content-Disposition: attachment; filename=$filename.csv");
 5         header("Content-Transfer-Encoding: binary"); 
 6         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 7         header("Pragma: no-cache");
 8         header("Expires: 0");
 9         header(application/txt;charset=gb2312);
10         header( Content-Transfer-Encoding: binary );
11         ob_clean();
12         //echo chr(0xFF).chr(0xFE);
13         if(is_array($array))
14         {
15             if(is_array(@$array[0]))
16             {
17                 foreach ($array as $tmp)
18                 {
19                     echo $this->est_iconv($this->charset, gb2312,".join(",",$tmp).");
20                     echo "\r\n";
21                 }
22             }
23             else
24             {
25                 echo $this->est_iconv($this->charset, gb2312, join(,,$array));
26             }
27         }
28         else
29         {
30             $this->ErrorMsg("param is not array");
31             return false;
32         }
33     }

 

thinkphp csv.class.php文件导出gb2312格式csv

原文:http://www.cnblogs.com/shenaishiren/p/7998738.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!