PHPExcel_Writer_Exception with message “Could not close zip file php://output.”
代码中的 $objWriter->save("php://output"); 导致错误,解决如下:
<span style="white-space:pre"> </span>/*解决Excel2007不能导出*/
function SaveViaTempFile($objWriter){
$filePath = '' . rand(0, getrandmax()) . rand(0, getrandmax()) . ".tmp";
$objWriter->save($filePath);
readfile($filePath);
unlink($filePath);
}
点此打开原文
用上面的代码替换save方法即可 SaveViaTempFile($objWriter);
运行结果图: