在codeigniter中获取请求的控制器钩子预控制器 [英] get the requested controller in hook precontroller in codeigniter
本文介绍了在codeigniter中获取请求的控制器钩子预控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了实现这一点,我想运行precontroller钩子和检查如果用户使用ci会话登录。但是,我必须知道用户想要访问哪个控制器。
$ this-> router-> fetch_class();扩展CI_Controller,这应该可以工作。
I'm trying to make a simple routing rule to allow only authenticated users to certain controllers.
To achieve this, I would like to run precontroller hook and check if the user is logged in using ci session. However, I have to know which controller the user wants to access. How do I know this in a hook function?
解决方案
$this->router->fetch_class();
Extend CI_Controller and this should work.
这篇关于在codeigniter中获取请求的控制器钩子预控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文