Parsing a xml file using simplexml and accessing properties

前端 未结 1 563
無奈伤痛
無奈伤痛 2021-01-16 02:19

I am trying to parse a xml file which has this structure:

 
- 

        
相关标签:
1条回答
  • 2021-01-16 02:26

    Try this out:

    $resXml = simplexml_load_file($requestUrl); //$requestUrl is where the xml file is located
    
    foreach ($resXml->readCalls->classify->classification->class as $d) {
        $currClassificationName = $d['className'];
        $currClassificationRating = (float) $d['p'];
        echo "$currClassificationName: $currClassificationRating" . "</br>";
    }
    
    0 讨论(0)
提交回复
热议问题