使用simple_html_dom在html中获取一些单词

时间:2014-06-18 08:12:50

标签: php html simple-html-dom

我想通过simple_html_dom从下面的html行获取zumbainsomething

<p> <div align="left" style="margin: 0.00mm 0.00mm ;"> <p style="font-family: Arial; font-size: 1.0em;"> <b>zumbai</b> <i>n</i> something </p> </div>

这是我的代码:

foreach($html->find('div.align') as $tag1) {
      foreach($tag1->parent()->find('p.style') as $tag2){
               $words1  = $tag2->first_child();
               $words11= $words1->plaintext;
               $words2  = $tag2->first_child()->first_child();
               $words22= $words2->plaintext;
      }
}

但它不起作用。谢谢你:))

0 个答案:

没有答案