ambitionphp/php-simple-html-dom-parser

Composer 版本的 PHP5+ HTML DOM 解析器,让您轻松操作 HTML!需要 PHP 5+。支持无效的 HTML。使用选择器在 HTML 页面上查找标签,就像 jQuery 一样。单行提取 HTML 内容。

1.5.4 2020-10-13 20:53 UTC

This package is auto-updated.

Last update: 2024-09-18 07:45:32 UTC


README

版本 1.5.2

PHP5+ 编写的 HTML DOM 解析器的 Composer 和 PSR-0 适配

PHP5+ 编写的 HTML DOM 解析器,让您轻松操作 HTML!需要 PHP 5+。支持无效的 HTML。使用选择器在 HTML 页面上查找标签,就像 jQuery 一样。单行提取 HTML 内容。

http://simplehtmldom.sourceforge.net/

安装

composer.phar

"require": {
    "sunra/php-simple-html-dom-parser": "1.5.2"
    }

使用

use Sunra\PhpSimple\HtmlDomParser;

...
$dom = HtmlDomParser::str_get_html( $str );
or 
$dom = HtmlDomParser::file_get_html( $file_name );

$elems = $dom->find($elem_name);
...