Home  >  Article  >  Backend Development  >  PHPExcel browser output Excel2007 error

PHPExcel browser output Excel2007 error

WBOY
WBOYOriginal
2016-07-30 13:30:301078browse

Click here to view the code

PHPExcel_Writer_Exception with message “Could not close zip file php://output.”PHPExcel browser output Excel2007 error

<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);
	}

Click here to open the original text

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn