当前位置:Gxlcms > PHP教程 > php读取xml属性_PHP教程

php读取xml属性_PHP教程

时间:2021-07-01 10:21:17 帮助过:35人阅读

$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 "
";
}
echo "--------------------

";
}

?>


data.xml



www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486011.htmlTechArticle?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-attributes...

人气教程排行