nguyenanhung/php-simple-html-dom-parser

Composer 兼容版本:一个用 PHP5+ 编写的 HTML DOM 解析器,让您可以非常容易地操作 HTML!需要 PHP 5+。支持无效 HTML。就像 jQuery 一样使用选择器在 HTML 页面上查找标签。单行提取 HTML 内容。

v1.6.0 2022-06-17 03:40 UTC

This package is auto-updated.

Last update: 2024-09-17 08:38:58 UTC


README

==========================

版本 1.5.2

A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

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);
...