simplexml_import_dom Get a SimpleXMLElement object from a DOM node
发表日期:2021-07-01 08:57:25 | 来源: | | 浏览(703) 分类:SimpleXML 函数
simplexml_import_dom
(PHP 5, PHP 7, PHP 8)
simplexml_import_dom — Get a SimpleXMLElement
object from a DOM node
说明
$node
, string|null $class_name
= SimpleXMLElement::class): SimpleXMLElement|nullThis function takes a node of a DOM document and makes it into a SimpleXML node. This new object can then be used as a native SimpleXML element.
参数
-
node
-
A DOM Element node
-
class_name
-
You may use this optional parameter so that simplexml_import_dom() will return an object of the specified class. That class should extend the SimpleXMLElement class.
返回值
Returns a SimpleXMLElement or null
on failure.
范例
示例 #1 Importing DOM
<?php $dom = new DOMDocument; $dom->loadXML('<books><book><title>blah</title></book></books>'); if (!$dom) { echo 'Error while parsing the document'; exit; } $s = simplexml_import_dom($dom); echo $s->book[0]->title; ?>
以上例程会输出:
blah
参见
- dom_import_simplexml() - Gets a DOMElement object from a SimpleXMLElement object
- Basic SimpleXML usage
- PHP(0)
- PHP杂项(34)
- PHP基础-李炎恢系列课程(20)
- 中文函数手册(0)
- 错误处理 函数(13)
- OPcache 函数(6)
- PHP 选项/信息 函数(54)
- Zip 函数(10)
- Hash 函数(15)
- OpenSSL 函数(63)
- Date/Time 函数(51)
- 目录函数(9)
- Fileinfo 函数(6)
- iconv 函数(11)
- 文件系统函数(81)
- 多字节字符串 函数(57)
- GD 和图像处理 函数(114)
- 可交换图像信息(5)
- Math 函数(50)
- 程序执行函数(11)
- PCNTL 函数(23)
- JSON 函数(4)
- SPL 函数(15)
- URL 函数(10)
- cURL 函数(32)
- 网络 函数(33)
- FTP 函数(36)
- Session 函数(23)
- PCRE 函数(11)
- PCRE 正则语法(19)
- 数组 函数(81)
- 类/对象 函数(18)
- 函数处理 函数(13)
- 变量处理 函数(37)
- SimpleXML 函数(3)
- simplexml_import_dom Get a SimpleXMLElement object from a DOM node(0)
- simplexml_load_file Interprets an XML file into an object(0)
- simplexml_load_string Interprets a string of XML into an object(0)
- 杂项 函数(31)
- 字符串 函数(101)