遇到错误.无法加载请求的类:数据库


An Error Was Encountered. Unable to load the requested class: database

application/controller/目录中名为logincontroller.php的登录控制器是:

<?php
class LoginController extends CI_Controller {
public function __construct() {
    parent::__construct();
    $this->load->model('LoginModel');
    $this->load->library('form_validation');
    $this->load->database();
} 

public function index(){
$this ->load ->view('login_view');
}
public function checklogin(){
    $this->form_validation-> set_rules('email', 'email', 'required|valid_email');
    $this->form_validation-> set_rules('password', 'password', 'required|callback_verifyUser');
    if($this -> form_validation ->run() == false){
        $this->load->view('login_view');
    }else{
             redirect('dashcontroller/index');
    }
}

public function verifyUser(){
    $email = $this -> input -> post('email');
    $password= $this -> input ->post('password');
    $this->load->model ('LoginModel');
    if($this->LoginModel->login($email, $password)) {
        return true;
    }else{
        $this ->form_validation->set_message('verifyUser','wrong email or password');
        return false;
}
}

}?>

为什么会出现错误

我也在数据库的autoload.php中更改为$autoload['libraries'] = array('database');

我收到错误:无法加载请求的类:数据库

此错误可能是由于某些原因造成的。

1) Somehow the filename of the library managed to chance causing CodeIgniter to be unable to find the file

2) Perhaps the file doesn't exist on the server and once again, CodeIgniter is unable to find it.

3) The filename may be different to that you are referring to in your code.

检查源