代码点火器控制器无法使用帮助程序中的功能


Codeigniter Controller cannot use function within helper

>我有控制器

<?php
class Onetimescan extends CI_Controller{
    public function index() {
            #LOAD -->>>> LIB ###########
           $this->load->library('session');  ##    LOAD LIBS:  SESSION 
           $this->load->helper('simpledom');
           #LOAD -->>>> MODEL
           $this->load->model('scanmodel');
                $this->scanmodel->loadurlbasedonsessid($this->session->userdata('session_id')); // echo out inserted domain in loadurlbasedonsessid() func
                $sss= $this->session->userdata('tld'); // echo $sss;
       $siteToSearch = file_get_html($sss);
       foreach($siteToSearch->find('form') as $element){
            echo "<h1 style='color:red; '>".$element->action."</h1> <br />";
        }     
    }
}
?>

我收到此行Call to a member function find() on a non-object的致命错误:

   foreach($siteToSearch->find('form') as $element){

simpledom 是我在顶部加载的一个帮助程序(实际上称为 simpledom_helper.php),它有一个定义如下file_get_html:

[http://pastebin.com/HaJtKfNb][1]

我在这里做错了什么?我尝试像public function file_get_html{}一样定义函数,但这引发了错误。

我通过添加以下内容解决了这一切:

$prefix = "http://www.";
                //echo "SSS is:  ".$sss;
           $siteToSearch = file_get_html($prefix.$sss);

固定的>>URL 正在尝试get_file_contents(somedomain.com),并且缺少作为完全限定域的http://www.。此功能似乎get_file_contents需要http://www.

应该像这样调用帮助程序函数,因为它们不是对象:

$this->load->helper('simpledom');    
$siteToSearch = file_get_html($sss);