Not to load an autoload library in codeigniter

好久不见. 提交于 2019-12-02 07:45:50

Autoloading is meant for site-global items.

A cleaner solution may be to extend the controller and load the library in that new controller's constructor. Then all of your controllers extend from that controller, except the one(s) you don't want to load that library - those can extend the original CI controller.

That should take you < 5 minutes to implement and you won't have to hack anything.

You can take a look at this link:

http://xplus3.net/2010/05/31/conditional-auto-loading-of-libraries-in-codeigniter/

Basically, you'd be overwriting the autoload.php library to check for a variable. If that variable is false, then explicitly add the specific library to the autoload array.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!