我想在点击“记住我”复选框时保存电子邮件和密码,cookie应该设置在“记住我”上。登录工作正常。请帮助我在codeignitor中的代码,这是我的控制器代码:
public function loginaction()
{
$email=$this->input->post('email');
$password=$this->input->post('password');
$where = array('email'=>$email,'password'=>$password);
$tbname='login';
$query = $this->Insert_Model->viewdata($tbname,$where);
if(empty($query))
{
$data['msg']="Invalid email or password";
$this->load->view('login',$data);
}
else
{
redirect('dashboardv1');
}
}
以下是我实现的cookie代码:
function set()
{
$cookie= array(
'name' => 'chkremember',
'value' => 'test',
'expire' => '300',
'secure' => TRUE
);
$this->input->set_cookie($cookie);
}
function get()
{
echo $this->input->cookie('chkremember',true);
}
慕勒3428872