最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
PHP用DOM方式处理HTML之《Simple HTML DOM》
时间:2022-06-24 20:50:09 编辑:袖梨 来源:一聚教程网
入门级
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('div.lookLeftname', 0)->plaintext
class=‘lookLeftname'的div中的纯文本
$dom->find('div.lookLeftname', 0)->innertext
class='lookLeftname'的div中的内部文本
完整测试实例
代码如下 | 复制代码 |
require_once("simple_html_dom.php"); for($i=1;$i<=21;$i++){ "; } ?> |
相关文章
- 《夜族崛起》铁匠西里尔位置一览 05-17
- 《寓言之地》1.02更新内容一览 05-17
- 《辐射4》steam好评率介绍 05-17
- 《夜族崛起》技能强化珠宝掉落说明 05-17
- 《辐射4》主机控制台介绍 05-17
- 《星露谷物语》海草和绿藻获取方法 05-17