作者:西北人6668_733 | 来源:互联网 | 2018-03-11 18:45
simple_html_dom插件
用dom处理html文件的利器
使用:
加载simple_html_dom.php文件
代码如下:
require_once 'simple_html_dom.php'
new simple_html_dom对象
代码如下:
$dom = new simple_html_dom()
加载html
代码如下:
$dom->load($html);
find()方法
代码如下:
$dom->find('p.lookLeftname', 0)->plaintext
class=‘lookLeftname'的p中的纯文本
代码如下:
$dom->find('p.lookLeftname', 0)->innertext
class='lookLeftname'的p中的内部文本
plaintext 与innertext最常用的