我是 codeigniter 的新手,我正在开发一个带有会话的基本身份验证系统。我正在使用版本3.1.11请注意,我正在我的本地主机服务器上进行开发。项目网址: http://localhost/tutorial/codeigniter登录网址: http://localhost/tutorial/codeigniter/login/index.php/auth/login用户个人资料网址: http://localhost/tutorial/codeigniter/login/index.php/user/profile另外,我的登录代码有效。控制器:Auth.phppublic function __construct(){ parent::__construct(); $this->load->database(); $this->load->helper('url');}public function login(){ $this->form_validation->set_rules("username", "Username", "required"); $this->form_validation->set_rules("password", "Password", "required|min_length[7]"); if($this->form_validation->run() == TRUE) { .... if ($row) { $this->session->set_flashdata("success", "Success!!!"); $_SESSION["user_logged"] = TRUE; $_SESSION["username"] = $user->username; // redirect to profile page redirect('user/profile', 'refresh'); } else { $data['error']="<div class='alert alert-danger'>Invalid login details</div>"; } } $this->load->view("login", @$data);}控制器:User.phpclass User extends CI_Controller{ public function profile() { echo "Profile Page"; }}问题:我想在用户成功登录后将用户重定向到http://localhost/tutorial/codeigniter/login/index.php/user/profile 。我用于重定向的代码是redirect('user/profile', 'refresh');上面重定向代码的问题在于,它被重定向到http://localhost/tutorial/login/index.php/user/profile -- The /codeigniteris not included您知道如何正确重定向到http://localhost/tutorial/codeigniter/login/index.php/user/profile吗?任何帮助是极大的赞赏。谢谢
- 2 回答
- 0 关注
- 91 浏览
添加回答
举报
0/150
提交
取消