안녕하세요. codeigniter를 처음 사용했습니다. 컨트롤러 내부에서 모델을로드하려고하는데 Fatal error: Class 'application\models\CI_Model'
을 찾을 수 없습니다. 내가 모델을로드하기 전에 뭔가를 설정해야합니까
codeigniter로드 모델 오류
내 컨트롤러 :
class VerifyLogin extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->model('user','',TRUE);
}
function index(){
$this->load->library('form_validation');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|min_length[6]');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|is_unique[users.email]');
if ($this->form_validation->run()==false)
{
$this->load->view('header');
$this->load->view('marketing/marketing_custom_header');
$this->load->view('menu_2');
$this->load->view('marketing/marketing');
$this->load->view('footer');
}else{
redirect('home', 'refresh');
}
}
}
내 모델 :
class User extends CI_Model {
function __construct(){
parent::__construct();
}
function login($email,$password){
$this->db ->select('id, email, password');
$this->db -> from('users');
$this->db -> where('email',$email);
$this->db -> where('password',$password);
$this->db -> limit(1);
$query ="";
$query ->$this ->db ->get();
if($query ->num_rows()==1){
return $query->resilt();
}else{
return false;
}
}
}
코드가 잘 찾고 있습니다. 모델을로드하는 동안 TRUE를 패스 한 특별한 이유가 있습니까? –
모델 파일의 이름은 무엇이며 응용 프로그램에서 파일의 위치는 무엇입니까? –
TRUE를 전달하는 이유는 DB에 연결하기위한 것입니다. – user3041833