2017-05-04 74 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

使用的東西,這溪流因此數據將使用較少的內存總量,而不是在內存

相關問題