我有这种情况:
<div class="listing_title">
<strong>
<a href="http://www.mywebsite.com/dectails23291.html" id="url_id_1977">
Listing Title
</a>
</strong>
</div>
要获得列表标题,我已经实现了以下代码:
$page = "http://www.mywebsite.com/listings.html";
$html = new simple_html_dom();
$html->load_file($pagina);
foreach($html->find('.listing_title') as $element)
echo $element->first_child()->plaintext . '<br>';
输出是:
Listing Title
现在我需要获取 id 值
url_id_1977
最好只有“1977”,清除“url_id_”,但我不知道。提前致谢!!