2017 © Pedro Peláez
 

library php-htmldom

this is a html dom plugins

image

weijihao/php-htmldom

this is a html dom plugins

  • Thursday, July 26, 2018
  • by weijihao
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • -96 % Grown

The README.md

php-htmldom

PHP语言写的HTMLDOM, (*1)

安装步骤

1、确保已经安装了 Composer 或者 下载了 composer.phar, (*2)

composer require weijihao/php-htmldom

或者, (*3)

在composer.json文件添加如下代码:, (*4)

"require": {
    "weijihao/php-htmldom": "^0.1.0"
}

调用插件

1、在CakePHP里调用, (*5)

use Weijihao\HtmlDom\HtmlDom;

...
$htmlDom = new Weijihao\HtmlDom\HtmlDom();

$html = $htmlDom->str_get_html( $str );
//or
$html = $htmlDom->file_get_html( $file_name );

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

2、在跟目录创建调用实例文件 index.php,代码如下:, (*6)

require_once "vendor/autoload.php";

$htmlDom = new Weijihao\HtmlDom\HtmlDom();

$html = $htmlDom->str_get_html('

Hello
World
'); $html->find('div', 1)->class = 'bar'; echo $html->find('div[id=hello]', 0)->innertext; echo "\n <br/>"; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; // Output:
foo
World
$htmlDom->dump_html_tree($html); // $htmlDom = new Weijihao\HtmlDom\HtmlDom(); $htmDom = $htmlDom->file_get_html("http://www.baidu.com"); foreach ($htmDom->find('a') as $element) { echo $element->href . $element->innertext . '<br>'; }

The Versions

26/07 2018

dev-master

9999999-dev

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao

26/07 2018

0.1.3

0.1.3.0

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao

24/11 2016

0.1.2

0.1.2.0

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao

24/11 2016

dev-develop

dev-develop

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao

23/11 2016

0.1.1

0.1.1.0

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao

23/11 2016

0.1.0

0.1.0.0

this is a html dom plugins

  Sources   Download

MIT

by Avatar weijihao