=在php中,PHPExcel在PHP7中,save(‘php://output’)出现ERR_INVALID_RESPONSE错误的解决方法...
在php7之前是可以正常導(dǎo)出的,在php7中使用save(‘php://output’)出現(xiàn)ERR_INVALID_RESPONSE的錯(cuò)誤主要是下面錯(cuò)誤導(dǎo)致。
1.header和緩沖區(qū)的錯(cuò)誤導(dǎo)致,下面示例代碼可以正常導(dǎo)出:
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.錯(cuò)誤語(yǔ)法導(dǎo)致:打開(kāi)PHPExcel\Calculation\Functions.php文件,刪除掉581行的break即可。
喜歡 (10)or分享 (0)
總結(jié)
以上是生活随笔為你收集整理的=在php中,PHPExcel在PHP7中,save(‘php://output’)出现ERR_INVALID_RESPONSE错误的解决方法...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: yii2 关掉php notice,yi
- 下一篇: php redis命令大全,redis中