привет я новичок в codeigniter Я пытаюсь загрузить модель внутри контроллера, и я получаю Fatal error: Class 'application\models\CI_Model'
не найден. Нужно ли мне установить что-то прежде, чем я загрузить модель
codeigniter load models error
Мой контроллер:
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 для подключения к БД. – user3041833