不要在codeigniter中加载自动加载库 [英] Not to load an autoload library in codeigniter

查看:136
本文介绍了不要在codeigniter中加载自动加载库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个所有控制器使用的库。但对于一个特定的控制器,我不想加载该库。是否有任何方式我可以停止加载那个控制器的库。

I have a library which is used by all controllers. But for a specific controller i dont want to load that library. Is there any way i can stop loading that library for that controller.

我使用这个命令,但它失败:

$ this-> load - > library('xyz',array('autoload'=> FALSE));

i am using this command but its failing:
$this->load->library('xyz',array('autoload' => FALSE));

感谢

推荐答案

自动加载是为网站全局项目。

Autoloading is meant for site-global items.

一个更清洁的解决方案可能是扩展控制器和加载库控制器的构造函数。然后所有的控制器扩展从该控制器,除了你不想加载那个库 - 那些可以扩展原来的CI控制器。

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.

应该带你< 5分钟实现,你不会有任何东西。

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

这篇关于不要在codeigniter中加载自动加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆