//$this->load->view('welcome_message');
$this->load->library('Simple_html_dom');
$html = file_get_html('http://localhost/test/reg.htm');
foreach($html->find('.single_block ul.company_info') as $e)
{
echo $e->plaintext;
}
递进搜索
//$this->load->view('welcome_message');
$this->load->library('Simple_html_dom');
$html = file_get_html('http://localhost/test/reg.htm');
foreach($html->find('.single_block ul.company_info li') as $e)
{
echo $e->find('.gray',0)->plaintext;
}
本文介绍了一种使用Simple_html_dom库从指定网页中抓取特定类别的元素信息的方法。通过加载库并解析目标网址,可以遍历查找所需元素,并进一步提取其纯文本内容。
257

被折叠的 条评论
为什么被折叠?



