我在尝试删除xhtml中的节点时遇到错误.
代码是:
foreach($post->getElementsByTagName('a') as $key=>$a)
{
$post->removeChild($a);
}
Run Code Online (Sandbox Code Playgroud)
致命错误:/var/www/content.php(24)中带有"未找到错误"消息的未捕获异常"DOMException":在/var/www/content.php中引发的content-> fetch()#2 {main}第192行
如果我使用img标签,它会删除除一个img节点之外的所有节点,并且没有致命错误.
这里发生了什么?