在 div 内跳过 div 简单 html dom

Skip div within div simple html dom

我要从中抓取数据的页面具有以下元素

<div class="content">
 <p>I want this</p>
 <p>I want this</p>
 <div class="row">
   <p>I do not want this</p>
   <p>I do not want this</p>

 </div>
</div>

我不想要<div class="row">中的段落 到目前为止,这是我尝试过的。似乎不起作用

foreach ($sample_html->find('div[class=entry-content]') as $content) {

                foreach($content->find('div[class=row]') as $row){

                    foreach ($row->find('p') as $skip) {

                        $skip->outertext = '';
                    }
                }

                foreach($content->find('p') as $paragraph){

                    //echo $paragraph;
                    $paragraphs .= '<p>'.$paragraph->innertext.'</p>';
                    echo $paragraphs;
                }


            }

改变

 $skip->outertext = '';

 $skip->innertext= '';