<分区>
我正在尝试解析一个大小约为 1GB 的制表符分隔文件。
我在哪里运行我得到的脚本:
Fatal error: Allowed memory size of 1895825408 bytes exhausted (tried to allocate 1029206974 bytes) ...
我现在的脚本是:
$file = file_get_contents('allCountries.txt') ;
$file = str_replace(array("\r\n", "\t"), array("[NEW*LINE]", "[tAbul*Ator]"), $file) ;
我已将 php.ini 中的内存限制设置为 -1,这会给我:
Fatal error: Out of memory (allocated 1029963776) (tried to allocate 1029206974 bytes)
有没有办法部分打开文件,然后转到下一部分,从而减少一次使用的内存?