The Dom\NamedNodeMap class

(PHP 8 >= 8.4.0)

简介

Represents the set of attributes on an element.

类摘要

class Dom\NamedNodeMap implements IteratorAggregate, Countable {
/* 属性 */
public readonly int $length;
/* 方法 */
/* Not documented yet */
}

属性

length
The number of attributes.

注释

注意: 此 DOM 扩展在处理方法或属性时使用 UTF-8 编码。 解析器方法会自动检测编码,或允许调用者指定编码。

添加备注

用户贡献的备注 1 note

up
1
cyrille37 at gmail dot com
1 day ago
To access attribute value use getNamedItem() method :
<?php
$imgNode
= $dom->querySelector('figure img');
echo
$imgNode->attributes->getNamedItem('src')->value,"\n";
?>
To Top