Home > Backend Development > PHP Tutorial > PHPExcel导出的问题,PHP版本7.0

PHPExcel导出的问题,PHP版本7.0

WBOY
Release: 2016-06-06 20:10:37
Original
1865 people have browsed it

升级到php7之后phpexcel导出excel出现此问题,在php5环境下可以导出。

PHPExcel导出的问题,PHP版本7.0

code:

<code>$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/vnd.ms-execl");
header('Content-Disposition:attachment;filename="xxx.xls"');
header("Content-Transfer-Encoding:binary");
$objWriter->save('php://output');</code>
Copy after login
Copy after login

回复内容:

升级到php7之后phpexcel导出excel出现此问题,在php5环境下可以导出。

PHPExcel导出的问题,PHP版本7.0

code:

<code>$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/vnd.ms-execl");
header('Content-Disposition:attachment;filename="xxx.xls"');
header("Content-Transfer-Encoding:binary");
$objWriter->save('php://output');</code>
Copy after login
Copy after login

错误提示:

<code>Fatal error: 'break' not in the 'loop' or 'switch' context in Function.php</code>
Copy after login

这是1.8版本运行在php7上存在的一个Bug,将phpexcel升级至1.8.1就可以了。

github的issue有没有碰到过跟你一样的问题的人,或者stackoverflow搜一下。我用过5下的execl没用过7的

Related labels:
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