The Dom\Document class
(PHP 8 >= 8.4.0)
Introduction
Represents an entire HTML or XML document; serves as the root of the document tree.
This is the modern, spec-compliant equivalent of DOMDocument. It is the base class for Dom\XMLDocument and Dom\HTMLDocument.
Class synopsis
Properties
implementationThe DOMImplementation object that handles this document.
doctypeThe Document Type Declaration associated with this document.
URLEquivalent to documentURI.
characterSetThe encoding of the document used for serialization. Upon parsing a document, this is set to the input encoding of that document.
inputEncodingLegacy alias for characterSet.
charsetLegacy alias for characterSet.
documentURIThe location of the document or null if undefined.
The Dom\Element that is the document element.
This evaluates to null for document without elements.
First child element or null.
Last child element or null.
The number of child elements.
childrenA Dom\HTMLCollection containing all child elements of this node. Available as of PHP 8.5.0.
body
The first child of the html element that is either a
body tag or a frameset tag.
These need to be in the HTML namespace.
If no element matches, this evaluates to null.
The first head element that is a child of the
html element.
These need to be in the HTML namespace.
If no element matches, this evaluates to null.
The title of the document as set by the title
element for HTML or the SVG title element for SVG.
If there is no title, this evaluates to the empty string.
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
