update page now
PHP 8.4.16 Released!

DOMCdataSection::__construct

(PHP 5, PHP 7, PHP 8)

DOMCdataSection::__construct新しい DOMCdataSection オブジェクトを作成する

説明

public DOMCdataSection::__construct(string $data)

新しい CDATA ノードを作成します。これは、DOMText クラスと同じように動作します。

パラメータ

data

CDATA ノードの値。省略した場合は、空の CDATA ノードを作成します。

例1 新しい DOMCdataSection オブジェクトの作成

<?php

$dom
= new DOMDocument('1.0', 'utf-8');
$element = $dom->appendChild(new DOMElement('root'));
$text = $element->appendChild(new DOMCdataSection('root value'));
echo
$dom->saveXML();

?>

上の例の出力は以下となります。

<?xml version="1.0" encoding="utf-8"?>
<root><![CDATA[root value]]></root>

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant