0
我想要从XML文件中的数据,我需要以呼应产品检索XML数据
data.xml文件的属性值----
<products>
<product id="123" />
</products>
php文件---
$xml = new DomDocument();
$xmlFile = "data.xml";
$xml= DOMDocument::load($xmlFile);
$product = $xml->getElementsByTagName("product");
foreach($product as $node)
{
$id = $node->getElementsByAttributeName("id");
$id = $address->item(0)->nodeValue;
echo"$id";
}
啊,你应该引用你的XML数据:没办法告诉它是什么。 – Femi 2011-05-13 04:50:22