PHPExcel输出错误Could not close zip file php://output
浏览量:861
what:
PHPExcel输出Excel2007出错:
显示:“Uncaught exception 'PHPExcel_Writer_Exception' with message 'Could not close zip file php://output.'”

why:
代码中的 $objWriter->save("php://output"); 导致错误
how:
function SaveViaTempFile($objWriter){ $filePath = '' . rand(0, getrandmax()) . rand(0, getrandmax()) . ".tmp"; $objWriter->save($filePath); readfile($filePath); unlink($filePath); }用上面的代码替换save方法即可 SaveViaTempFile($objWriter);


感谢支持与鼓励~