致命错误:在生产服务器上找不到类“CI_Model”,在本地运行

时间:2013-07-29 14:35:36

标签: codeigniter fatal-error

我们正在使用CodeIgniter 2.1.4构建Web应用程序。它处于爬行阶段。现在,它只有一个基本的日志记录和注册系统。

我们到目前为止在本地运行的功能如何,但是当我们在线尝试时,我们会收到以下错误:

Fatal error: Class 'CI_Model' not found in /home4/csurmeli/public_html/other/ems/system/core/Common.php on line 174

由于我们没有更改任何核心文件,因此没有任何意义。我们的在线服务器已经建立。

有什么建议吗?

控制器呼叫登录:

    function login(){

        if($this->session->userdata('userid') !== false){
            redirect(base_url()."index.php/users/success");
        }

        $data['error'] = 0;
        if($_POST){
            $this->load->model('user');
            $username = $this->input->post('username',true);
            $password = $this->input->post('password',true);
            $user = $this->user->login($username,$password);

            if(!$user){
                $data['error']=1;
                redirect(base_url()."index.php/users/error");
            }else{
                $this->session->set_userdata('userid',$user['userid']);
                $this->session->set_userdata('privilege',$user['privilege']);
                redirect(base_url()."index.php/users/success");
            }   
        }

        $this->load->view('header');
        $this->load->view('login',$data);
        $this->load->view('footer');
    }

型号:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    Class User Extends CI_Model{

        public function __construct(){
            parent::__construct();
        }       
        function create_user($data){
            if($data['is_sent']){
            $query = array("username" => $data['username'],
                            "password" => $data['password'],
                            "email" => $data['email']
                        );
            $this->db->insert('users',$query);
            }
        }

        function login($username,$password){
            $where =  array(
                'username'=>$username,
                'password'=>$password
                );

            $this->db->select()->from('users')->where($where);
            $query = $this->db->get();
            return $query->first_row('array');
        }

    }

?>

1 个答案:

答案 0 :(得分:0)

如果它在本地工作 - 它可能只是主index.php页面上的一个问题

index.php中的

找到横幅:SYSTEM FOLDER NAME和APPLICATION FOLDER NAME 然后仔细检查文件路径和文件夹名称是否适合您的服务器。

相关问题