Home > Article > Backend Development > PHPExcel browser output Excel2007 error
Click here to view the code
<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); }
Replace the save method with the above code SaveViaTempFile($objWriter);
Running result picture:
Click here to open the source code
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the error when PHPExcel browser outputs Excel2007, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.