首页 > 代码库 > simple_html_dom(3)
simple_html_dom(3)
How to traverse the DOM tree?
// If you are not so familiar with HTML DOM, check this link to learn more...
// Example
echo $html->find("#div1", 0)->children(1)->children(1)->children(2)->id;
// or
echo $html->getElementById("div1")->childNodes(1)->childNodes(1)->childNodes(2)->getAttribute(‘id‘);
You can also call methods with Camel naming convertions.
Method | Description |
---|---|
mixed $e->children ( [int $index] ) | Returns the Nth child object if index is set, otherwise return an array of children. |
element $e->parent () | Returns the parent of element. |
element $e->first_child () | Returns the first child of element, or null if not found. |
element $e->last_child () | Returns the last child of element, or null if not found. |
element $e->next_sibling () | Returns the next sibling of element, or null if not found. |
element $e->prev_sibling () | Returns the previous sibling of element, or null if not found. |
simple_html_dom(3)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。