(PHP 8 >= 8.3.0)
DOMElement::getAttributeNames — 获取属性名称
此函数没有参数。
返回属性名称。
示例 #1 DOMElement::getAttributeNames() 示例
<?php
$dom = new DOMDocument();
$dom->loadXML('<html xmlns:some="some:ns" some:test="a" test2="b"/>');
var_dump($dom->documentElement->getAttributeNames());
?>以上示例将输出
array(3) {
[0]=>
string(10) "xmlns:some"
[1]=>
string(9) "some:test"
[2]=>
string(5) "test2"
}