|
//模型
class Loginmodel extends CI_Model{
public function __construct() {
parent::__construct();
}
public function login($admin,$pwd,$table){
$dbtable = $this->db->dbprefix($table);
$query = $this->db->query("select username,password from $dbtable where username =$admin and password = $pwd limit 1");
if($query->num_rows()>0)
return $this->session->set_userdata('userid',$username);
else
return flase;
}
}
//控制器
public function checkadmin() {
$this->load->model('loginmodel');
$username = $this->input->post('username');
$password = md5($this->input->post('password'));
$captcha = $this->input->post('captcha');
if($captcha != $this->session->userdata('captcha'))
{
jsalert('请登录',site_url('admin/admin/login.php'));
}
if($this->loginmdoel->login($username,$password,'admin'))
{
header('Location:'.site_url('admin/admin/login.php'));
}
}
错误提示Message: Undefined property: Admin:loginmdoel
在model函数打印出了 loginmodel application/models/loginmodel.php
弄了好久不知道什么错误
|
|