Laravel(5.2)Excel下载xls错误ERR_INVALID_RESPONSE(chrome)

我不能下载/导出xlsxlsx ,只能以csv格式

 $data = Orders::get(); $xls = Excel::create('Orders', function($excel) use($data) { $excel->sheet('orders', function($sheet) use($data) { $sheet->fromArray($data); }); })->download('xls'); return redirect()->back(); 

我试图ob_clean在方法_download(行317)laravelexcelwriter.php,上面的保存function(行341),没有结果。 另外在保存function(第341行)中,我尝试了类似的I / Ostream选项(默认为php://output ),就像php://stdoutphp://stderrphp://fdphp://memory仍然没有结果。

这是一个php.ini的问题? 服务器问题? 我应该在哪里检查?

我认为您在Google Chrome浏览器中遇到了与我所做的错误相同的错误。 你有没有安装php的ziparchive模块? 请尝试安装。 如果你在PHP 7中,那么以下可能会帮助你。

 sudo apt-get install php7.0-zip 

谢谢,Alex

编辑时间限制和内存限制为我固定。 试试如果你把这个放在Excel :: create()方法之前,会发生什么情况:

 set_time_limit(0); ini_set('memory_limit', '1G');