Codeigniter:更改一个控制器的自动加载库? [英] Codeigniter: Change autoload libraries for one controller?

查看:60
本文介绍了Codeigniter:更改一个控制器的自动加载库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在autoload.php中具有以下库:

$autoload['libraries'] = array('database', 'session');

我到处都需要会话库-除了ONE控制器以外,它只会造成麻烦.现在的问题是:

I need the session lib everywhere - besides of ONE controller, where it causes only trouble. Now the question is:

是否有可能不为此特殊控制器加载会话库,或者是从自动加载中将其删除并在需要时将其添加到每个单个控制器的唯一选择?

Is there a possibility NOT to load the session lib for this special controller or is the only option to delete it from the autoload and add it to every single controller, where needed?

推荐答案

在您的autoload.php中:

In your autoload.php:

$autoload['libraries'] = array('database');

$CI =& get_instance();
if ($CI->router->fetch_class()!='conflictingcontroller') array_push($autoload['libraries'], 'session');

这篇关于Codeigniter:更改一个控制器的自动加载库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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