2014-09-30 72 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

相关问题