CodeIgniter: Load controller within controller

后端 未结 10 1732
余生分开走
余生分开走 2020-11-28 07:43

I have a home controller with an index action that displays a set of featured products. However, the products are managed through a product

10条回答
  •  遥遥无期
    2020-11-28 08:24

    Just to add more information to what Zain Abbas said:

    Load the controller that way, and use it like he said:

    $this->load->library('../controllers/instructor');
    
    $this->instructor->functioname();
    

    Or you can create an object and use it this way:

    $this->load->library('../controllers/your_controller');
    
    $obj = new $this->your_controller();
    
    $obj->your_function();
    

    Hope this can help.

提交回复
热议问题