=在php中,PHPExcel在PHP7中,save(‘php://output’)出现ERR_INVALID_RESPONSE错误的解决方法...
在php7之前是可以正常導出的,在php7中使用save(‘php://output’)出現ERR_INVALID_RESPONSE的錯誤主要是下面錯誤導致。
1.header和緩沖區的錯誤導致,下面示例代碼可以正常導出:
header('Content-type: application/vnd.ms-excel;charset=utf-8;name="' . $xlsTitle . '.xls"');
header("Content-Disposition: attachment; filename=$fileName.xls");
header('Cache-Control: max-age=0');
//header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//header ('Cache-Control: cache, must-revalidate');
header ('Pragma: public');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
2.錯誤語法導致:打開PHPExcel\Calculation\Functions.php文件,刪除掉581行的break即可。
喜歡 (10)or分享 (0)
總結
以上是生活随笔為你收集整理的=在php中,PHPExcel在PHP7中,save(‘php://output’)出现ERR_INVALID_RESPONSE错误的解决方法...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: yii2 关掉php notice,yi
- 下一篇: java11开源中国,Java 11 正