本文介绍了如何使用DOMDocument类删除HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用DOMDocument类删除HTML元素?

Is there a way to remove a HTML element by using the DOMDocument class?

推荐答案

http: //us2.php.net/manual/en/domnode.removechild.php

DomDocument是一个DomNode.您可以仅调用remove child,就可以了.

DomDocument is a DomNode.. You can just call remove child and you should be fine.

刚注意到您可能正在谈论当前正在使用的页面.不知道DomDocument是否会工作.您可能想在那时使用javascript(如果已经将它提供给客户端)

Just noticed you were probably talking about the page you are working with currently. Don't know if DomDocument would work. You may wanna look to use javascript at that point (if its already been served up to the client)

这篇关于如何使用DOMDocument类删除HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 17:54