耗尽允许内存大小我想火的队列从Excel文件导入,所以我做的:
队列文件laravel - 在队列
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Excel::filter('chunk')->load(storage_path('engine-valves.xlsx'))->chunk(500, function($results) {
\Illuminate\Support\Facades\File::put(storage_path('data2.txt'), json_encode($results));
});
}
但听过程中,我得到标准错误Allowed memory size of xxx bytes exhausted
。有一刻我试图设置ini_set('memory_limit', '-1');
,但仍然出现此错误。有这个错误的全部行:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 100663304 bytes) in [app_path]\vendor\phpoffice\phpexcel\Classes\PHPExcel\Cell.php on line 889
。
我正在使用:https://github.com/Maatwebsite/Laravel-Excel
哪里可以解决问题?
太大的文件保存在内存中,所以你需要阅读它作为一个ByteStream或什么 – aaron0207