-3

我有这个 HTML 代码

<div id="first" class="first">
    One
    <div id="second" class="second">
        Second
        <div id="third" class="third">
            Third
            <div id="fourth" class="fourth">
                Fourth
                <div id="fifth" clas="fifth">
                   Fifht
                   <div id="sixth" class="sixth">
                       Sixth
                   </div>
                </div>
            </div>
        </div>
    </div>
</div>

此代码来自外部网站。我想使用来自 URL 的简单 HTML DOM 显示“嗨”。

4

1 回答 1

0

你想看到这样的东西吗?

$el = $html->find("#first", 0);
while ($child = $el->children(1)) {
    $el = $child;
}
echo $el->innertext;
于 2012-12-10T21:06:38.113 回答