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
Codeigniter功能未定义错误_Codeigniter - Fatal编程技术网

Codeigniter功能未定义错误

Codeigniter功能未定义错误,codeigniter,Codeigniter,application/core/My_Controller.php中的我的自定义核心类 class MY_Controller extends CI_Controller{ protected $data = array(); function __construct(){ parent::__construct(); } function rander_page($view){ //do this to don't

application/core/My_Controller.php中的我的自定义核心类

class MY_Controller extends CI_Controller{

    protected $data = array();


    function __construct(){

        parent::__construct();

    }

    function rander_page($view){

        //do this to don't repeate in every controller
        $this->load->view('includes/header');
        $this->load->view('top_menus');
        $this->load->view($view, $this->data);
        $this->load->view('includes/footer');

    }

}
索引应用程序中的控制器/控制器

class Index extends MY_Controller{

    function __construct(){
        parent::__construct();  
    }

    function index(){

        $this->render_page('index');

    }

}
错误是:致命错误:调用第10行D:\wamp\www\ci\application\controllers\Index.php中未定义的方法Index::render\u page()


我正在尝试为所有帮助页使用一个控制器。plz

您拼错了函数名。调用$this->rander_页面(“索引”)是的,错误是线索本身,它提到函数未定义。您尚未定义render_page函数。相反,您拼写错误并将其命名为rander_page()

可能您正试图写:

function render_page()
正如你所说的:

$this->render_page('index');

为什么不能使用库而不是在核心文件夹中修改/添加代码?在
MY\u Controller
it
render\u page
not
rander\u page