Home > Backend Development > PHP Tutorial > Codeigniter's dom class usage example_PHP tutorial

Codeigniter's dom class usage example_PHP tutorial

WBOY
Release: 2016-07-13 09:48:26
Original
868 people have browsed it

Codeigniter’s DOM class usage example

This article describes the Codeigniter DOM class usage example. 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/

Modification:

Replace simple_html_dom with CI_Simple_html_dom in batches.

Place it under applicationlibraries:

 ?

1

2

3

4

5

6

7

8

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 . '
';

}

1

2 3

45 6 7 8
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 . '
'; }
I hope this article will be helpful to everyone’s PHP programming based on Codeigniter. http://www.bkjia.com/PHPjc/1022670.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1022670.htmlTechArticleCodeigniter’s DOM class usage examples. 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 to modify a CI...
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