码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-12-07 15:05:32      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:return   color   validate   echo   导出   coding   格式   ati   head   

 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

标签:return   color   validate   echo   导出   coding   格式   ati   head   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!