DOMComment::__construct
(PHP 5, PHP 7)
DOMComment :: __ construct - 创建一个新的DOMComment对象
描述
public DOMComment::__construct ([ string $value ] )
创建一个新的DOMComment对象。该对象是只读的。它可以被附加到文档中,但是直到该节点与文档相关联时,附加节点才可以被附加到该节点。要创建可写节点,请使用DOMDocument :: createComment。
参数
value
评论的价值。
例子
示例#1创建一个新的DOMComment
<?php
$dom?=?new?DOMDocument('1.0',?'iso-8859-1');
$element?=?$dom->appendChild(new?DOMElement('root'));
$comment?=?$element->appendChild(new?DOMComment('root?comment'));
echo?$dom->saveXML();?/*?<?xml?version="1.0"?encoding="iso-8859-1"?><root><!--root?comment--></root>?*/
?>
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com