DOM Parser动态id

时间:2013-02-27 07:54:26

标签: php dom

id-any number

<div id="news-id-1" style="display:inline;"></div>
<div id="news-id-31" style="display:inline;"></div>
<div id="news-id-320" style="display:inline;"></div>

如何做到这一点? (谷歌翻译)

foreach ($html->find('div[id=news-id-?????]', 0)  as $e2) {     
        echo $e2;
}

1 个答案:

答案 0 :(得分:0)

$html->find("div[id^='news-id-']", 0)

应该有用。