从下一个标签获取文本

Mar*_*lln 4 php regex simple-html-dom

我有一个看起来像这样的html片段(当然包围其他html):

<p class="finfot3"><b>Header:</b></p>
<p>Text</p>
Run Code Online (Sandbox Code Playgroud)

我怎么能从中得到Text这个?我正在使用simple_html_dom,但如果simple_html_dom不能这样做,我可以使用其他东西.

Lei*_*igh 5

这是未经测试的,但您可能正在寻找simple_html_doms next_sibling()方法.

$html->find('p[class=finfot3]')->next_sibling()->innertext() 应该返回第二个<p>元素的内容.