我正在使用简单的 html dom。我有这个代码:
<html>
<div class="one">
<div class="two">this is inner text </div>
<a href="#" class="three">this is inner anchor</a>
This is outer test
</div>
</html>
我只想取This is outer test
。这是我的代码:
$html = file_get_html(SITE_URL.'/forumlist.php');
$html->find('.two',0)->outertext = "";
$html->find('.three',0)->outertext = "";
$html->save();
echo $html->find('.one',0)->plaintext;
我很失望..