0
在應用/控制器/目錄下名爲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');
我得到錯誤:無法加載所請求的類:數據庫