开发者

Loading all codeigniter controller at the beginning

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 .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜