Home >Backend Development >PHP Tutorial >phpexcel 为什么无法生成xlsx文件

phpexcel 为什么无法生成xlsx文件

WBOY
WBOYOriginal
2016-06-13 12:04:351072browse

phpexcel 为何无法生成xlsx文件

<br />header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');<br />header('Content-Disposition: attachment;filename="fee_detail.xlsx"');<br />header('Cache-Control: max-age=0');<br /><br />$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');<br />$objWriter->save( 'php://output');<br />

为何无法生成xlsx文件。

<br />header('Content-Type: application/vnd.ms-excel');<br />header('Content-Disposition: attachment;filename="fee_detail.xls"');<br />header('Cache-Control: max-age=0');<br /><br />$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');<br />$objWriter->save('php://output');<br />

可以生成xls文件。
------解决方案--------------------
无法生成xlsx,有错误信息吗?或者其他提示信息
------解决方案--------------------
经测试可以生成.xlsx ,你在$objWriter->save( 'php://output');后面加上exit();试试。

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