$oa=new domdocument();$oa->load("o.xml");
$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
可以在两个系统间转换
但你也得先转再用吧
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号