php读取xml文件并获取值

queryxml.sh

#!/sbin/php -q
load($fileName);
    
    $paras = $doc->getElementsByTagName($LIST_TAG);
    foreach($paras  as $para){
        $name  = $para->getElementsByTagName($NAME_TAG)->item(0)->nodeValue;
        $value = $para->getElementsByTagName($VALUE_TAG)->item(0)->nodeValue;
        if($name == $setName){
            //$para->getElementsByTagName($VALUE_TAG)->item(0)->nodeValue = $setValue;
            //echo $name."-".$value."==>".$setValue;
            echo $value;
            break;
        }
    }
?>

你可能感兴趣的:(php读取xml文件并获取值)