zvook/php5-simple-html

simple_html_dom包装器

1.2.0 2016-04-19 12:44 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:36:58 UTC


README

适用于simple_html_dom的可用包装器

使用简单_html_dom与您的IDE一起使用时,让您感到愉快

用法

添加到您的composer.json文件中

"require": {
    "zvook/php5-simple-html": "*"
}

示例

use SimpleHtml\Dom;

$dom = Dom::str_get_html('<html></html>');
$dom = Dom::file_get_html('http://www.google.com/');

$div = $dom->getElementById('id1');
foreach ($div->getElementByTagName('table.table-class')->find('tr') as $row) {
    $firstCell = $row->find('td', 0);
    $thirdCell = $row->find('td', 2);
    $content = $thirdCell->plaintext;
}