0
我正在使用簡單的html dom。我有這個代碼:簡單的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;
和我失望..
你得到了什麼錯誤? – Peon 2013-02-11 08:21:27
我得到了一切..'這是內心的文字,這是內部錨點這是外部測試' – 2013-02-11 08:23:07