如何在PHP中创建DOMNode? [英] How to create a DOMNode in PHP?
问题描述
课程 DOMNode
不提供构造器,也没有提供 static
方法,如 createInstance()
。那么,如何创建一个 DOMNode
实例?
The class DOMNode
doesn't provide a contructor and also no static
methods like createInstance()
. So, how to create an DOMNode
instance?
推荐答案
创建一个 DOM文档
。它从DOMNode扩展,具有构造函数,并且表示文档的根节点。作为DOMNode,DOMDocument具有添加子项的方法。例如,DOMDocument有一个方法 CreateElement ,它返回一个DOMElement,其中也从DOMNode继承。总而言之,DOMNode似乎只是基类,不能直接使用。
Create a DOMDocument
. It extends from DOMNode, has a constructor, and represents the rootnode of a document. Being a DOMNode, DOMDocument has methods for adding children. For instance, DOMDocument has a method CreateElement, which returns a DOMElement, which also inherits from DOMNode. All in all, it seems that DOMNode is just the base class and shouldn't be used directly.
这篇关于如何在PHP中创建DOMNode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!