好像你想读一个大的excel文件。
错误状态,PHP需要234881024字节更多比你分配(1024M),其中翻译为224M。
将memory_limit
增加为'2048M'之类的东西,看它是否有效。出于测试目的,你可能想分配无限的内存到PHP:
ini_set('memory_limit', '-1')
顺便说一句,这是很多分配给PHP。尝试以块的形式读取文件,而不是一次读取整个文件。
我的建议是看看nuovo/spreadsheet-reader包,它专门设计用来读取大文件。引用来自文档:
spreadsheet-reader is a PHP spreadsheet reader that differs from others in that the main goal for it was efficient data extraction that could handle large (as in really large) files. So far it may not definitely be CPU, time or I/O-efficient but at least it won't run out of memory (except maybe for XLS files).
据我所知,你使用的是CodeIgniter。为了整合这个包笨,你需要enable composer support:
Additionally, if you want CodeIgniter to use a Composer auto-loader, just set $config['composer_autoload']
to TRUE
or a custom path in your application's application/config/config.php file.
之后,您可以访问SpreadsheetReader
类。请参阅documentation以了解如何充分利用它来读取大型excel文件。
您可以附上调试跟踪结果吗?我猜测这个问题是不够的。 –