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

PHPExcel导出的问题,PHP版本7.0

WBOY
WBOYOriginal
2016-06-06 20:10:371862browse

升级到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>

回复内容:

升级到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>

错误提示:

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

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

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

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