$a=$oa->getelementsbytagname(am)->item(0);
foreach($a->attributes() as $x=>$y) {
echo $x; echo $y;
}
我想要读取xml指定节点的所有属性名和值,
为什么会出错
fatal error: call to undefined method domelement::attributes()
回复讨论(解决方案) domelement ::getattribute
simplexmlelement::attributes
两个不同的系统,不要弄混了
虽然有:
dom_import_simplexml
simplexml_import_dom
可以在两个系统间转换
但你也得先转再用吧
