首页 > 代码库 > php导出中文乱码问题(mac)

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

  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)