一:PHPExcel插件是非常好用的,平时也一直用它导出xlsx文件,一直也用的很顺手,接口调试的时候已是正常的,能够输出csv文件的,但是接口嵌入到程序中,按钮触发没反应。一点点的排查,发现输出了一些个蝌蚪文,乱码!
首先,想到的是header的问题,如下,这里是处理过乱码的问题了,但是没有效果;
//弹窗式保存 ob_end_clean();//清除缓冲区,避免乱码 header("Pragma: public"); header("Expires: 0"); header("Cache-Control:must-revalidate, post-check=0, pre-check=0"); header("Content-Type:application/force-download"); header("Content-Type:application/vnd.ms-execl"); header("Content-Type:application/octet-stream"); header("Content-Type:application/download"); header("Content-disposition: attachment; filename=" . $filename . ".xlsx"); header("Content-Transfer-Encoding:binary");
怎么办,不能放弃呀,继续加header,结果没用。。。。。。
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;