2017-05-04 26 views
0

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'); 
+0

有一切你可以看看流读取JSON。在谷歌搜索,你可能会找到解决方案 –

回答

2

使用的东西,这溪流因此数据将使用较少的内存总量,而不是在内存

相关问题