I am working with codeigniter in php and my question is that How can i Call an external controller in a controller located in controllers folder.
//this file is Controller2.php in controllers folder
class Controller2 extends CI_Controller
{
function one()
{
// Some code goes here..
}
}
//and now this file is Controller1.php which is also in controllers folder
class Controller1 extends CI_Controller
{
function one()
{
// I want to load Controller2 here
}
}
Please instruct me as i’ve wasted so much time during googling.
Thanks in advance..
Kamran
You can’t, or rather you shouldn’t. Any functionality that you need to use in two different controllers should be moved to a library or helper file.