CodeIgniter 404 Bad request error

独自空忆成欢 提交于 2019-12-24 19:31:12

问题


I'm working with codeIgniter. I am making a login form which checks the members details with the database.

However when I click to login I get this error message:

The requested URL /waitronmain/login.php/login/validate_credentials was not found on this server.

However this is my login.php file and as you can see validate_credentials() does exist.

class Login extends CI_Controller{


function index()
{
    $data['main_content'] = 'login_form';
    $this->load->view('includes/template', $data);
}

function validate_credentials()
{
    //load model to query db
    $this->load->model('membership_model');
    $query = $this->membership_model->validate();

    if($query){ //if credentials validated
        $data = array(
            'username' => $this->input->post('username'),
            'is_logged_in' => true

            );

            $this ->session->set_userdata($data);
            redirect('site/members_area');
    }

    else{ //if not validated load login form again.
        $this->index();

    }

}

}

Any idea what's going wrong? I should be going on to the 'members_area' page as I know the details I am entering are correct.

Any help would be much appreciated.


回答1:


what is this??

/waitronmain/login.php/login/validate_credentials

login.php should be not in url i think you should do:

/waitronmain/login/validate_credentials

(assuming you removed index.php from urls and you are inside the waitronmain/ root )



来源:https://stackoverflow.com/questions/14866158/codeigniter-404-bad-request-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!