DOMComment->__construct()
DOMComment->__construct() — 新しい DOMComment オブジェクトを作成する
説明
class DOMComment {__construct ( [string value] )
} 新しい
DOMComment
オブジェクトを作成します。
このオブジェクトは読み込み専用です。このオブジェクトをドキュメントに
追加することが可能ですが、ノードがドキュメントと関連付けられるまでは
ノードを追加することはできません。書き込み可能なノードを作成するには、
DOMDocument->createComment() を使用します。
パラメータ
- value
-
コメントの値。
例
例 485. 新しい 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> */
?>
参考
DOMDocument->createComment() |
- DOMComment->__construct()のページへのリンク