<?php// 新建一个Dom实例$html->load_file('http://www.cnphp.info/php-simple-html-dom-parser-intro.html');    // 从字符串中加载    $html->load('从字符串中加载html文档演示');    //从文件中加载    $html->load_file('path/file/test.html');?>说是三种加载方式  但是load_file这是什么函数  手册里面也查不到

解决方案 »

  1.   

    load_file 是 simple_html_dom 类中定义的一个方法。
        function load_file() {
            $args = func_get_args();
            $this->load(call_user_func_array('file_get_contents', $args), true);
            // Per the simple_html_dom repositiry this is a planned upgrade to the codebase.
            // Throw an error if we can't properly load the dom.
            if (($error=error_get_last())!==null) {
                $this->clear();
                return false;
            }
        }使用 simple_html_dom 的方法有
    $sh = file_get_html('文件名或url');
    $sh = str_get_html('字符串');
    $sh = new simple_html_dom('文件名或url或字符串');当然你说的也是,不过显得累赘些