解決方法,將PHPExcel/Shared/OLE.php中的第290行的continue修改為break,截圖如下:
================
在調用save("php://output")之前調用ob_end_clean()
===============
添加header
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/force-download");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $excel_filename . '.xls"');
header('Cache-Control: max-age=0');
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header ('Cache-Control: cache, must-revalidate');
header("Pragma: public");
header("Expires: 0");
header("Content-Transfer-Encoding:binary");
header("Content-Type:application/octet-stream");
版權聲明:本文為CSDN博主「你是大馬猴嗎」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_40780723/article/details/89420953