효율적이고 사용하기 쉽고 빠른 PHP JSON 스트림 파서
https://github.com/halaxa/json-machine
JSON 머신은 PHP 5.6 이상을 위한 큰 JSON 파일 또는 스트림의 비효율적 인 반복을 위한 효율적인 드롭 인 대체입니다.
<?php // this often causes Allowed Memory Size Exhausted - $users = json_decode(file_get_contents('500MB-users.json')); // this usually takes few kB of memory no matter the file size + $users = \JsonMachine\JsonMachine::fromFile('500MB-users.json'); foreach ($users as $id => $user) { // just process $user as usual }
의도적으로 $users [42]와 같은 임의 접근 또는 count ($users)와 같은 계산 결과는 불가능합니다.
위에서 언급 한 foreach를 사용하여 항목을 찾거나 컬렉션을 계산하십시오.
등록된 댓글이 없습니다.