Analysis of php plug-in SimpleHTMLDOM using DOM processing HTML_PHP tutorial-php Tutorial

Source: Internet
Author: User
Analysis of php plug-in SimpleHTMLDOM using DOM to process HTML. The simple_html_dom plug-in uses dom to process html files. the code for loading the simple_html_dom.php file copy code is as follows: require_oncesimple_html_dom.phpnewsimple_html_dom object simple_html_dom plug-in
A powerful tool for processing html files with dom
Usage:
Load the simple_html_dom.php file

The code is as follows:


Require_once 'simple _ html_dom.php'


New simple_html_dom object

The code is as follows:


$ Dom = new simple_html_dom ()


Load html

The code is as follows:


$ Dom-> load ($ html );


Find () method

The code is as follows:


$ Dom-> find ('P. lookleftname', 0)-> plaintext


Class = plain text in p of 'lookleftname'

The code is as follows:


$ Dom-> find ('P. lookleftname', 0)-> innertext


Class = internal text in p of 'lookleftname'
Commonly used plaintext and innertext

The following code loads the simple_html_dom.php File: require_once 'simple _ html_dom.php 'new simple_html_dom object...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.