未定义的属性:user::$load



我得到以下错误:

未定义的属性:user::$load

这是我的代码:

<?php defined('BASEPATH') OR exit('No direct script access allowed');
class users extends CI_Controller{

    function _construct(){
            parent::_construct();
        }  
    function index(){
        $this->load->view('login');
    }
    function Login(){
        $this->load->model('user');
        $query=$this->user->validate();
        if($query){
                $data=array(
                      'username'=>$this->input->post['UserName'],
                      'is_logged_in'=> true
                );
            $this->session->set_userdata($data);
            $this->load->view('purchaser_home');
        }
        else{
            $this->index();
        }
    }
}
?>

为什么会出现上述错误?

将其更改为

'username'=>$this->input->post['UserName'],

这个

'username'=>$this->input->post('UserName'),

这应该是

$this->index();

更改为

redirect('controllername')

autoload.php

加载表单hepler、URL助手以及

最新更新