php读取xml属性_PHP教程
程序员文章站
2024-01-06 12:57:40
...
$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