간단해서 좋다...


function removeAll($node)
{
    while ($node->childNodes->length) $node->removeChild($node->firstChild);
}




$doc = new DOMDocument('1.0', 'UTF-8');
// html 소스 로딩
$doc->loadHTML($html);
// xx라는 id를 가진 노드의 하위노드를 몽땅 날림
removeAll($doc->getElementById('xx'));
...
...
unset($doc);






 
Posted by bloodguy
,