2014-09-30 74 views
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');

我得到錯誤:無法加載所請求的類:數據庫

回答

0

這個錯誤可能是由於一些原因。

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.

檢查source

相關問題