首页 > PHPExcel导出的问题,PHP版本7.0

PHPExcel导出的问题,PHP版本7.0

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

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

错误提示:

Fatal error: 'break' not in the 'loop' or 'switch' context in Function.php

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


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

【热门文章】
【热门文章】