PHP: Can't remove node from DomDocument

后端 未结 1 1058
梦如初夏
梦如初夏 2021-01-23 04:33

I Can\'t remove node from DomDocument(get Exception):

My Code:



        
相关标签:
1条回答
  • 2021-01-23 05:06

    First off, what exception are you getting (It likely matters).

    As for the specific problem, my guess would be as follows::

    The $node is not a child of the document. It's a child of its parent. So you'd need to do:

    $node->parentNode->removeChild($node);
    
    0 讨论(0)
提交回复
热议问题