2017-05-04 3 views
0

JSONファイル名:testjsonfile.json "testjsonfile.json" の大きなJSONデータ[2GB]をPHPに読み込むには?

サイズは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

のすべてを持つより少ない総メモリを使用しますストリーム。 googleで検索すると、解決策が見つかることがあります –

答えて

0
set_time_limit(0); 
ini_set('memory_limit', '20000M'); 

。それに応じて20000Mを変更します。

関連する問題