您好,我已经创建了一个库Auth.php
来application/libraries
验证当前用户是否登录。所以我的控制器是:
$session_data = $this->session->userdata('logged_in');
$this->load->library('Auth');
$auth = new Auth;
$user_id = $auth->authenticate($session_data);
和图书馆:
class Auth{
function authenticate($vars){
$CI =&get_instance();
$CI->load->model('adminmodels/login_model');
$username = $vars['username'];
$password = $vars['password'];
$user_id = $vars['user_id'];;
$user_type = $vars['user_type'];
$check_login = $this->login_model->login($username,$password); //Line 14
if($check_login){
$user_id = $user_id;
}else{
$user_id = 0;
}
return $user_id;
}
}
但它显示如下错误:
遇到 PHP 错误
严重性:通知
消息:未定义的属性:Auth::$login_model
文件名:库/Auth.php
行号:14
我在做什么错??