I know this quention might seems duplicated, but i already tried those suggestions/advice but still couldn't solve this:
environment :
$autoload['libraries'] = array('email', 'session', 'database', 'form_validation');
controller :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Auth extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->library('form_validation');
$this->load->model('Auth_model', 'Auth');
}
private function _login()
{
$email = $this->input->post('email');
$password = $this->input->post('password');
$user = $this->model->Auth->getUser();
Model :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Auth_model extends CI_Model
{
public function getUser()
{
$email = $this->input->post('email');
// var_dump($email);die;
return $this->db->get_where('t_user', ['email' => $email])->row_array();
}
}
I Still got this error :
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Auth::$model
Filename: controllers/Auth.php
Line Number: 38
Change
$user = $this->model->Auth->getUser();
into
$user = $this->Auth->getUser();
try this into the class you will use Type $ this-> library -> (" library you want ")
. I hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.