解析しようとしている HTML ファイルがあります。次のような DIV がたくさんあります。
<div class="doc-overview">
<h2>Description</h2>
<div id="doc-description-container" class="" style="max-height: 605px;">
<div class="doc-description toggle-overflow-contents" data-collapsed-height="200">
<div id="doc-original-text">
Content of the div without paragraph tags.
<p>Content from the first paragraph </p>
<p>Content from the second paragraph</p>
<p>Content from the third paragraph</p>
</div>
</div>
<div class="doc-description-overflow"></div>
</div>
私はこれを試しました:
foreach($html->find('div[id=doc-original-text]') as $div) {
echo $div->innertext;
}
を直接見つけましたdoc-original-text
が、外側の div から内側の div への解析も試みました。