<div itemprop="commentText" class='post entry-content '>
<blockquote class="ipsBlockquote" data-author="B.A" data-cid="53143" data-time="1436336618">
<div>
<p>Text that I dont want</p>
</div>
</blockquote>
<p>Text that I want!</p>
<p>Text that I want!</p>
<blockquote class="ipsBlockquote" data-author="Mayor" data-cid="53141" data-time="1436336888">
<div>
<p>Text that I dont want</p>
<p>Text that I dont want! </p>
<p>Text that I dont want! </p>
</div>
</blockquote>
<p> </p>
<p>Text to retrieve</p>
</div>
如何检索不属于<p>
代码的<blockquote class="ipsBlockquote" ...>
代码中的文字?
foreach($html->find('div[itemprop=commentText]') as $element) {
foreach($element->find('p [!ipsBlockquote]') as $element2) {
echo $element2->innertext;
}
}
这就是我所拥有的。它仍然会检索我不想要的文本。