首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

DOMText::__construct

(PHP 5, PHP 7)

DOMText :: __ construct - 创建一个新的DOMText对象

描述

public DOMText::__construct ( string $value )

创建一个新的DOMText对象。

参数

value

文本节点的值。如果未提供,则会创建一个空文本节点。

例子

示例#1创建一个新的DOMText

代码语言:javascript
复制
<?php

$dom?=?new?DOMDocument('1.0',?'iso-8859-1');
$element?=?$dom->appendChild(new?DOMElement('root'));
$text?=?$element->appendChild(new?DOMText('root?value'));
echo?$dom->saveXML();?/*?<?xml?version="1.0"?encoding="iso-8859-1"?><root>root?value</root>?*/

?>

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com