严重性:通知
消息:未定义索引:密码
文件名:models / userr.php
行号:10
回溯:
文件:C:\ xampp \ htdocs \ cooladmin \ application \ models \ userr.php行:10 功能:_error_handler
文件:C:\ xampp \ htdocs \ cooladmin \ application \ controllers \ auth.php行: 17功能:登录
文件:C:\ xampp \ htdocs \ cooladmin \ index.php行:315功能: require_once
类用户扩展了CI_Model {
public function login($post)
{
$this->db->select('*');
$this->db->from('user');
$this->db->where('username', $post['username']);
$this->db->where('password', $post['password']);
$query = $this->db->get();
return $query;
}
类身份验证扩展了CI_Controller {
public function login()
{
$this->load->view('login');
}
public function process()
{
$post = $this->input->post(null, TRUE);
if(isset($post['login'])) {
$this->load->model('userr');
$query = $this->userr->login($post);
if($query->num_rows() > 0) {
echo "login berhasil !";
} else {
echo "login gagal !";
}
}
}
}
答案 0 :(得分:0)
使用此:
$this->db->where('password', isset($post['password']) ? $post['password'] : '');
这仅表示密码尚未从表单中发布