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
http://www.bkjia.com/PHPjc/327965.htmlwww.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...
Statement: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