定制 ijortengab/parse-html 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ijortengab/parse-html

最新稳定版本:v0.0.7

Composer 安装命令:

composer require ijortengab/parse-html

包简介

ParseHTML is PHP library working like jQuery, give you an easy way to get any information from text html.

README 文档

README

parseHTML is PHP library working like jQuery, give you an easy way to get any information from text html.

Requirement

PHP 5.4

Usage

If you familiar with jQuery, you'll be smile.

jQuery parseHTML
document $contents = file_get_contents('~/my.html');
$html = $(document); $html = new parseHTML($contents);
var title = $html.find('title').text(); $title = $html->find('title')->text();
var url = $html.find('a.links').attr('href'); $url = $html->find('a.links')->attr('href');

Method Support

Method Description
::find() http://api.jquery.com/find/
::html() http://api.jquery.com/html/
::text() http://api.jquery.com/text/
::attr() http://api.jquery.com/attr/
::eq() http://api.jquery.com/eq/
::getElementById() https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
::getElementByClass() https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
::getElementByTag() https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName
::getElementByAttribute() https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Method/getElementsByAttribute

Selector Support

You can find more description by visit this link http://api.jquery.com/category/selectors/

Selector Example
ID selector #my-table-1
Class Selector .links'
Element Selector element
Descendant Selector ancestor descendant
Child Selector parent > child
Attribute [name]
Attribute Contains Prefix Selector ```[name
Attribute Contains Selector [name*='value']
Attribute Contains Word Selector [name~='value']
Attribute Ends With Selector [name$='value']
Attribute Equals Selector [name='value']
Attribute Not Equal Selector [name!='value']
Attribute Starts With Selector [name^='value']

Of course, you can mix all selector above, example:

  • #form-register.front input
  • a.links[ref='nofollow']
  • div.office > span.address

and, you can get multiple selector, example:

  • 'input, textarea, select, button'

Simlilar Project

PHP Simple HTML DOM Parser

统计信息

  • 总下载量: 5.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2015-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固