更新时间:2022-11-26 17:28:17
您知道什么..您将花费时间寻找URI_STRING THING的工作吗?
You know what ..you will spend your time looking to make work for URI_STRING THING?
但是,我已经为你的人们做了一个解决方案...
But , i have made a solution to you folks ...
获取动作和控制器
像Weclome / Home,users / login,sell / sell,sell / index,sell /','/'
//get the current URL
$controller= $this->uri->segment(1); // controller
$action = $this->uri->segment(2); // action
$url = $controller . '/' . $action;
//'this returns / sometimes and also like sell/ returned'
if( ($this->ion_auth->logged_in()== false )&& (in_array($url,$public_allowed_urls) ) )
{
redirect('users/login');
}
done men!
已编辑:
$ this-> uri-> segment(1);
不能是控制器名称所有时间。获取控制器名称使用 $ this-> router-> class
和方法 $ this-> router->
$this->uri->segment(1);
cannot be controller name all time.To get controller name use $this->router->class
and for method $this->router->method