I've a little problem.
In a controller i will load a function wich is in otherController.
I just use
$pCtrl = new otherController;
for loading the class in that otherControll开发者_运维知识库er.
The problem is that at that moment the otherController has not already been loaded. So the class is not available.
Can i find a way to tell codeigniter to load all controllers (folder controller) before doing other thing ?
Thanks for help.
This is bad practice. You should be using a CodeIgniter Library to do this instead.
Though, if you're already doing bad things, you could just open the /controllers directory in your config/autoload.php and configure codeigniter to autoload all available controllers. Not sure if this will work well (and efficiently) in practice, so try using libraries.
Its better to create a helper function or a library ..
oh btw , you can use HMVC also .
精彩评论