[英]CodeIgniter redirect() not working properly
下面给出的是我的管理员控制器的index()
(只有管理员才能访问此部分):
public function index() {
$this->load->helper('url');
$user = $this->session->user;
if (!$user)
$this->load->view('admin\login_form');
else
redirect('admin/dashboard'); // I tried redirect('dashboard'); too
}
如果用户已登录,它将重定向到localhost/store/localhost/store/index.php/dashboard
。 即,它将整个URL附加在我的基本URL(即localhost/store
)之后。 我还尝试将'refresh'
作为redirect()
的第二个参数。
尝试使用斜杠:
redirect('/admin/dashboard')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.