A brief analysis of the PHP plug-in Simple HTML DOM Processing HTML with DOM_PHP Tutorial

WBOY
Release: 2016-07-21 15:01:54
Original
1117 people have browsed it

simple_html_dom plug-in
A powerful tool for processing html files with dom
Use:
Load the simple_html_dom.php file

Copy code The code is as follows:

require_once 'simple_html_dom.php'

new simple_html_dom object
Copy code The code is as follows:

$dom = new simple_html_dom()

Load html
Copy code The code is as follows:

$dom->load($html);

find() method
Copy Code The code is as follows:

$dom->find('div.lookLeftname', 0)->plaintext

class=' Plain text in the div of lookLeftname'
Copy code The code is as follows:

$dom->find('div. lookLeftname', 0)->innertext

The inner text in the div with class='lookLeftname'
plaintext and innertext are most commonly used

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327965.htmlTechArticle The simple_html_dom plug-in is a powerful tool for processing html files using dom: Load the simple_html_dom.php file and copy the code. The code is as follows: require_once 'simple_html_dom .php' new simple_html_dom object...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template