如何在PHP中创建DOMNode? [英] How to create a DOMNode in PHP?

查看:128
本文介绍了如何在PHP中创建DOMNode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

课程 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆