PHP简单的HTML DOM解析器:在两个div之间选择

时间:2015-05-20 06:06:20

标签: php dom html-parsing

我正在尝试解析此HTML

<div id="id1">
  <div id="subclass"> TEXT1 </div>
</div>

<div id="id2">
  <div class="subclass"> TEXT2 </div>
</div>

<div class="class1 ">
  <div class="subclass"> TEXT3 </div>
</div>

这是视图页面。我想搜索id1到class1(div id =“id1”到div class =“class1”来查找)。我正在尝试这样

foreach($html->find('div#subclass-single>div.class1 a') as $e){
    echo $e->href . '<br>';
}

0 个答案:

没有答案