Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 助手未在Codeigniter中加载?_Php_Codeigniter_Helper - Fatal编程技术网

Php 助手未在Codeigniter中加载?

Php 助手未在Codeigniter中加载?,php,codeigniter,helper,Php,Codeigniter,Helper,这是我的简单控制器: public function _construct() { parent::_construct(); $this->load->helper('url'); } public function view($page = "index") { if ( ! file_exists(APPPATH.'/views/truelove_view/'.$page.'.php')) { // Whoops, we d

这是我的简单控制器:

public function _construct()
{
    parent::_construct();
    $this->load->helper('url');
}


public function view($page = "index")
{

    if ( ! file_exists(APPPATH.'/views/truelove_view/'.$page.'.php'))
    {
        // Whoops, we don't have a page for that!
        show_404();
    } 

        $this->load->view('truelove_view/templates/header.php');
        $this->load->view('truelove_view/'.$page);   
        $this->load->view('truelove_view/templates/footer.php');    
当我包括$this->load->helper('url');在view()中,代码可以工作,但当我像上面那样将其包含在构造函数中时,它就不能工作了。如果我自动加载url帮助程序,它也可以工作


有什么想法吗?

在提供的代码中,您有
公共函数\u构造()
,但它应该是
公共函数\u构造()
。您需要添加双下划线
\uuuu

使用数组加载帮助程序:

$this->load->helper( array('url') );

太棒了,谢谢你。这是一个下划线。我使用的是一个新的IDE,有些字符看起来不一样。Codelobster,从记事本++上改过来的,从来没有试过,但我听说过。我推荐Netbeans