如何将大型 json 文件转换为 php 数组


How to convert large json file to php array?

某些API提供88MB的json文件。我需要将其一些值存储在数据库中。

$cURL="url here"
$str = file_get_contents($cURL);
$str = json_decode($str);
echo '<pre>';
print_r($str);   

此代码不起作用,因为文件大小太大。我需要将该 json 文件转换为 php 数组。我无法解析此文件。有人帮忙吗?

如果在查询期间解决问题,则非常复杂。在文件系统上缓存初步数据,然后将值分成块将能够解决问题。