PHP的HTML解析工具 html-parser

码农软件 · 软件分类 · HTML解析器 · 2019-04-02 21:57:17

软件介绍

php html解析工具,类似与PHP Simple HTML DOM Parser。 由于基于php模块tidy,所以在解析html时的效率比 PHP Simple HTML DOM Parser 快2倍多。 并提供广度优先查询find()和深度优先查询find2() 两种查询方式,可根据自己的情况选择使用。 因为代码实现的问题,在查询全部时深度优先比广度优先快一点。

示例代码:

<?php
$html = '<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <p class="test_class test_class1">p1</p>
    <p class="test_class test_class2">p2</p>
    <p class="test_class test_class3">p3</p>
    <div id="test1">测试1</div>
  </body>
</html>';
$html_dom = new HtmlParserModel();
$html_dom->parseStr($html);
$p_array = $html_dom->find('p.test_class');
$p1 = $html_dom->find('p.test_class1',0);
$div = $html_dom->find('div#test1',0);
foreach ($p_array as $p){
    echo $p->getPlainText();
}
echo $div->getPlainText();
echo $p1->getPlainText();
echo $pi->class;
?>


本文地址:https://codercto.com/soft/d/2731.html

设计方法卡牌

设计方法卡牌

罗莎 等 / 电子工业出版社 / 2017-7 / 79.00

本套设计素材提供了54种设计方法,以卡牌的形式展示给读者,每张卡牌包括该设计方法的基本描述、目的、时间成本、工具渠道、使用阶段、操作步骤及其归类属性等信息。在做设计时,可以根据自己的需求进行卡牌的选择和组合,让设计工作更有灵活性和趣味性。同时,依据设计产品属性的不同,卡牌提供了选择设计方法的推荐模板、方法组合模板、产品阶段划分模板,给初学者在做设计时提供一定的理论依据,帮助读者启发设计灵感,剖析设......一起来看看 《设计方法卡牌》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具