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。在谷歌搜索,你可能會找到解決方案 –