嗨,我新来的只是工作在登录&注销。当我尝试注销时 显示URL未找到/ loginController /注销 问题是什么?是因为会议还是我错过了什么?Codeigniter PHP注销问题当点击注销URL未找到
这里是我的控制器上的指数函数
<?php
class loginController extends CI_Controller{ /**controller*/
public function index(){
$this->login();
}
public function login(){
$this->load->view('login');
}
public function home(){
if ($this->session->userdata('logged')){
$this->load->view('main');
} else {
redirect('loginController/denied');
}
}
public function denied(){
$this->load->view('denied_page');
}
public function login_validation() /**set rules*/
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('username',
'Username', 'required|min_length[3]|max_length[12]');
$this->form_validation->set_rules('password',
'Password', 'required|sha1|callback_password_check');
if ($this->form_validation->run()){ /** form valdation*/
$data = array(
'username' => $this->input ->post('username'),
'logged' => 1
);
$this->session->set_userdata($data);
redirect('main');
} else {
$this->load->view('login');
}
}
public function logout(){ //login
$this->session->sess_destroy();
redirect('login');
}
public function password_check(){
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->model('users');
if($this->users->log_in($username, $password)){
return True;
}else{
$this->form_validation->set_message('password_check',
'Incorrect username or password.');
return False;
}
}
}
?>
你肯定有不冲突的路线地方?你能发布路线吗? – 2014-11-08 06:30:27
它是我的路线$ route ['default_controller'] =“main”; $ route ['404_override'] =''; – 2014-11-08 15:33:50