
DOMDocument::createTextNode는 노드를 생성하는 메서드입니다. 노드의 내용은 생성 시점에 문자열로 변환되며, 이후에 변경할 수 없습니다.
DOMDocument::createTextNode를 사용하여 노드의 내용을 설정하는 방법은 없습니다. 대신, 노드를 생성한 후 노드의 내용을 설정할 수 있습니다.
예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$doc = new DOMDocument();
$node = $doc->createTextNode('Hello, World!');
$doc->appendChild($node);
또는, 노드를 생성한 후 노드의 내용을 설정할 수 있습니다.
#hostingforum.kr
php
$doc = new DOMDocument();
$node = $doc->createElement('p');
$node->nodeValue = 'Hello, World!';
$doc->appendChild($node);
2025-06-23 09:00