(PHP 8)
DOMCharacterData::remove — Removes the character data
此函数没有参数。
没有返回值。
示例 #1 DOMCharacterData::remove() example
Removes the character data.
<?php
$doc = new DOMDocument;
$doc->loadXML("<container><![CDATA[hello]]><world/></container>");
$cdata = $doc->documentElement->firstChild;
$cdata->remove();
echo $doc->saveXML();
?>
以上示例会输出:
<?xml version="1.0"?> <container><world/></container>