php读取xml属性
<?php
$dom=new DOMDocument(1.0);
$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 "<br/>";
}
echo "--------------------<p>";
}
?>
data.xml
<?xml version="1.0"?>
<videos>
<video img="a"url="1"title="1"nickname="1"tag="1"vid="1"star="1"/>
<video img="b"url="2"title="2"nickname="2"tag="2"vid="2"star="2"/>
<video img="c"url="3"title="3"nickname="3"tag="3"vid="3"star="3"/>
</videos>
补充:Web开发 , php ,