DOM DOMCdataSection::__construct
(PHP 5, PHP 7, PHP 8)
DOMCdataSection::__construct — 새로운 DOMCdataSection 객체를 생성합니다.
설명
public DOMCdataSection::__construct(string $data
)
새로운 CDATA 노드를 생성합니다. 이것은 DOMText 클래스처럼 작동합니다.
매개변수
data
- CDATA 노드의 값입니다. 제공하지 않으면 빈 CDATA 노드가 생성됩니다.
Examples
예제 #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>
기타
- DOMText::__construct() - 새로운 DOMText 객체를 생성합니다.
- DOMDocument::createTextNode() - 새 텍스트 노드 만들기