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

php导出中文乱码问题(mac)

时间:2014-08-26 17:10:26      阅读:700      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   java   io   ar   问题   

  public function test(){
         header("Content-type:application/vnd.ms-excel"); 
         header("Content-Disposition:attachment;filename=export_data.xls"); 
         echo   "姓名"."\t";  
         echo   "繁體"."\t";  
         echo   "博客"."\t";  
         echo   "\n";  
         echo   "jason"."\t";  
         echo   "@"."\t";  
         echo   "javaeye"."\t";  
     }
    public function test1(){
    $str=<<<EOT
        <html xmlns:o="urn:schemas-microsoft-com:office:office" 
         xmlns:x="urn:schemas-microsoft-com:office:excel" 
         xmlns="http://www.w3.org/TR/REC-html40"> 
         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
         <html> 
             <head> 
                <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> 
                 <style id="Classeur1_16681_Styles"></style> 
             </head> 
             <body> 
                 <div id="Classeur1_16681" align=center x:publishsource="Excel"> 
                     <table x:str border=0 cellpadding=0 cellspacing=0 width=100% style="border-collapse: collapse"> 
                         <tr><td class=xl2216681 nowrap>1234</td><td class=xl2216681 nowrap>Robbin会吐口水</td></tr> 
                        <tr><td class=xl2216681 nowrap>5678</td><td class=xl2216681 nowrap>javaeye网站</td></tr> 
                     </table> 
                 </div> 
             </body> 
         </html>
EOT;
    header("Content-type:application/vnd.ms-excel"); 
    header("Content-Disposition:attachment;filename=export_data.xls"); 
    echo $str;
    }

 

php导出中文乱码问题(mac)

标签:style   blog   http   color   os   java   io   ar   问题   

原文地址:http://www.cnblogs.com/zqsb/p/3937462.html

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