[英]ion_auth with codeigniter redirection issue
I'm using codeigniter 3 and ion_auth for authentication. 我正在使用codeigniter 3和ion_auth进行身份验证。
I'm trying to get a method in my controller to redirect to another method if not logged in, other than the auth/login page, but whatever i try, it still redirects to the auth/login page??? 我试图让我的控制器中的方法重定向到另一种方法,如果没有登录,除了auth /登录页面,但无论我尝试,它仍然重定向到auth /登录页面?
So for testing purposes, with this method, im trying to get it to redirect to a different method in the same controller 'new_index', but it still redirects to auth/login. 因此,出于测试目的,使用此方法,我试图让它重定向到同一控制器'new_index'中的不同方法,但它仍然重定向到auth / login。
Why is this? 为什么是这样?
public function index() {
// redirect if not logged in
if (!$this->ion_auth->logged_in()) {
// redirect them to the login page
redirect('new_index');
}
else {
$view_data = array(
'page_title' => 'Training Dashboard'
);
$this->load->view('training/training_dashboard',$view_data);
}
}
public function new_index(){
echo "Hello";
}
I don't get where the instruction to redirect to auth/login is coming from? 我没有得到重定向到auth / login的指令来自哪里?
您是否在配置中配置了Base Url。如果没有,请将其设置为指向项目目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.