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

phpexcel导出乱码

时间:2016-07-14 07:13:04      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:

在输出到浏览器时,要在head前加ob_end_clean();参考此文

ob_end_clean();
header(‘Content-Type: application/vnd.ms-excel‘);
header(‘Content-Disposition: attachment;filename="‘.$name.‘.xls"‘);
header(‘Cache-Control: max-age=0‘);

$objWriter->save(‘php://output‘);

ob_end_clean() - 清空缓冲区并关闭输出缓冲,因为此时的输出缓存里可能有其它内容,这样和phpexcel的输出混在一起,那么就不是需要的excel文件了。

phpexcel导出乱码

标签:

原文地址:http://www.cnblogs.com/xdao/p/php_excel.html

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