Home > Backend Development > PHP Tutorial > PHPExcel browser output Excel2007 error

PHPExcel browser output Excel2007 error

WBOY
Release: 2016-07-30 13:30:30
Original
1106 people have browsed it

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);
	}
Copy after login

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.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template