如何使用获取simple_html_dom
每个值aaa
,,,,?谢谢。bbb
ccc
ddd
HTML结构:
<body>
<div>
<div>
<div>
<div>
aaa
</div>
bbb
</div>
ccc
</div>
ddd
</div>
</body>
<?php
require('simple_html_dom.php');
$html = str_get_html('<body><div><div><div><div>aaa</div>bbb</div>ccc</div>ddd</div></body>');
echo $html->find('div', 0)->innertext.'<hr />'; //need output aaa
echo $html->find('div', 1)->innertext.'<hr />'; //need output bbb
echo $html->find('div', 2)->innertext.'<hr />'; //need output ccc
echo $html->find('div', 3)->innertext.'<hr />'; //need output ddd
?>