Home > Backend Development > PHP Tutorial > Codeigniter's dom class usage example, codeigniterdom_PHP tutorial

Codeigniter's dom class usage example, codeigniterdom_PHP tutorial

WBOY
Release: 2016-07-13 09:48:25
Original
968 people have browsed it

Codeigniter’s DOM class usage examples, codeigniterdom

This article describes the Codeigniter DOM class usage examples. Share it with everyone for your reference. The specific analysis is as follows:

Using the simple_html_dom dom class, a class library modified for CI, it can analyze HTML elements like JS. It is suitable for analyzing web page data when crawling web pages.

Class library download address: http://sourceforge.net/projects/simplehtmldom/

Modify:

Batch replace simple_html_dom with CI_Simple_html_dom.
Place under applicationlibraries:

function index() 
{ 
  //$this->load->view('welcome_message'); 
  $this->load->library('Simple_html_dom'); 
  $html = file_get_html('http://localhost/test.htm'); 
  foreach($html->find('a') as $e) 
  echo $e->href . '<br>'; 
}

Copy after login

I hope this article will be helpful to everyone’s PHP programming based on Codeigniter.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1022776.htmlTechArticleCodeigniter’s dom class usage examples, codeigniterdom This article describes the Codeigniter’s dom class usage examples. Share it with everyone for your reference. The specific analysis is as follows: Using the simple_html_dom dom class...
Related labels:
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