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; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。