我一直在使用 simplexml_load_file 来解析具有 15,000 条记录的 xml 文件,它工作正常,但是当我尝试处理许多文件时,每个文件都是 15,000,它给了我这个 errorPHP
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 64 bytes)
不知道该怎么做,以下是我正在做的示例,
$xml = simplexml_load_file($file)
or die("Error: Cannot create object");
foreach($xml->children() as $events){
foreach($events->load as $load){
$record = $load->loadrecord['record']." ";
if ($load->loadrecord['record'] == "test"){
foreach($events->receiveds as $received){
$release = $received->received['release'];
}
foreach($events->sender as $sender){
$test1 = $sender['test1'];
$test2 = $sender['test2'];
$test3 = $sender['test3'];
$test4 = $sender['test4'];
}
foreach($events->screens as $filter){
$record = $filter->filter['record'];
}
}
}
解析完成后是否需要释放一些东西,请注意文件很多时会出现问题,我尝试了两个文件,没有问题