php读取xml属性
程序员文章站
2022-06-17 15:45:58
...
$dom=new DOMDocument(1.0);
$dom->load(data.xml);
$dom->load(data.xml);
$items=$dom->getElementsByTagName(video);
echo $items-> item(0)->getattribute("img");
foreach($items as $a){
foreach($a->attributesas$b){
echo $b->nodeName;
echo ":";
echo $b->nodeValue;
echo "
";
}
echo "--------------------
";
}
?>
data.xml