class HtmlParser

Copyright (c) 2013, 俊杰Jerry All rights reserved.

Properties

DOMNode $node

Methods

__construct(DOMNode|string $node = null)

No description

load(null $node = null)

初始化的时候可以不用传入html,后面可以多次使用

mixed
__get(string $name)

No description

find(string $selector, number $idx = null)

深度优先查询

string
getPlainText()

返回文本信息

string
innerHtml()

获取innerHtml

string|bool
outerHtml()

获取outerHtml

string|null
getAttr(string $name)

获取html的元属值

Details

at line 35
__construct(DOMNode|string $node = null)

No description

Parameters

DOMNode|string $node

Exceptions

Exception

at line 60
load(null $node = null)

初始化的时候可以不用传入html,后面可以多次使用

Parameters

null $node 节点

Exceptions

Exception

at line 83
mixed __get(string $name)

No description

Parameters

string $name

Return Value

mixed

at line 109
HtmlParser|HtmlParser[]|bool find(string $selector, number $idx = null)

深度优先查询

Parameters

string $selector 选择器
number $idx

找第几个,从0开始计算,null 表示都返回, 负数表示倒数第几个

Return Value

HtmlParser|HtmlParser[]|bool

Exceptions

Exception

at line 145
string getPlainText()

返回文本信息

Return Value

string

at line 154
string innerHtml()

获取innerHtml

Return Value

string

at line 169
string|bool outerHtml()

获取outerHtml

Return Value

string|bool

at line 183
string|null getAttr(string $name)

获取html的元属值

Parameters

string $name 属性

Return Value

string|null