本文介绍了在PHP简单HTML DOM解析器中动态排除内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作一个基于PHP的应用程序,它将使用 PHP简单HTML DOM解析器。
I want to exclude some text between two HTML tags from the content dynamically.
Some description or content ETC ABC <span class="s"> May 3 2009 <b> ABC Some Text </b> Some photo or video...
我想删除所有由< span class = s> 到第一个< b>
HTML标记,因此输出为:
Some description or content ETC ABC <span class="s"><b> ABC Some Text </b> Some photo or video...
这应该使用 foreach 循环,其想法是将所有过滤的文本存储在变量中,例如
$ ftext
,然后必须应用一些简单的PHP,例如:
foreach($html->find('how_to_tell_those_filtered_text_here') as $ftext)
$result = str_replace($ftext, '', $result);
$result = str_get_html($result);
So, what should be the solution, any idea?
推荐答案
better if you use readability by Arc90 HTML content extractor
这篇关于在PHP简单HTML DOM解析器中动态排除内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!