Home > php教程 > PHP源码 > Codeigniter的dom类

Codeigniter的dom类

PHP中文网
Release: 2016-05-25 17:15:36
Original
1287 people have browsed it

利用simple_html_dom dom类为CI修改的一个类库,可以像JS一样对HTML元素进行分析,适合与抓取网页时,对网页数据进行的分析。 

修改: 
把simple_html_dom批量替换为CI_Simple_html_dom。 
放置在application\libraries下 

1. [代码]php代码 

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 . &#39;<br>&#39;;  
    }
Copy after login

                   


                   

Related labels:
php
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template