空函数在使用codeigniter登录时不起作用



这是我的登录表单

<form action="<?php echo site_url('admin/checkAdmin')?>
<div class="form-group">
<input type="text" name="email" placeholder="Enter Your Email" class="form-control">
</div>
<div class="form-group">
<input type="password" name="password" placeholder="Enter Your Password" class="form-control">
</div>
<div class="form-group">
<button class="btn btn-primary" type="submit">Signin</button>
</div>
</form>

还有我的控制器

public function checkAdmin()
{
$data['aEmail'] = $this->input->post('email', true);
$data['aPassword'] = $this->input->post('password', true);
if (!empty($data['aEmail']) && !empty($data['aPassword'])) 
{   
echo 'working';
} 
else
{
echo 'not working'; 
}
}

无论我是否输入了值,它仍然回响着"不起作用"。问题出在哪里?

控制器代码:-

class admin extends CI_Controller {
function login()
{
$email= $this->input->post("email");
$password = $this->input->post("password");  
$result = $this->db->get_where('table_name',array('email'=>$email,'password'=>$password))->row_array();
if ($result >0) //active user record is present
{

$url = base_url('admin/Admin/dashboard');
redirect($url);    
}
else{
redirect('admin/Admin');
}
}

}

相关内容

  • 没有找到相关文章

最新更新