JSON文件名:testjsonfile.json如何将大型json数据[2gb]加载到php中?
的 “testjsonfile.json” 的大小为2GB。
如何加载json文件? 代码:
$data = json_decode(file_get_contents(testjsonfile.json'), TRUE);
print_r($data);
错误:
Fatal error: Out of memory (allocated 1310720) (tried to allocate 1719707520 bytes) in test.php
注: 增加的内存限制
ini_set('memory_limit', '4000M');
有一切你可以看看流读取JSON。在谷歌搜索,你可能会找到解决方案 –