具体如下:
check(I('post.yanzhengma','','trim'))){
// 注释部分为另外一种从数据库中验证密码的方法
// $data['name'] = I('post.user_name');
// $data['psd'] = I('post.password');
// $row = M('user')->where($data)->find();
$name = I('post.user_name');
$psd = I('post.password');
$str = 'name ="'.$name. '" and tel = "'.$psd.'"';
var_dump($str);
$row = M('user')->where($str)->find();
if($row)
$this->redirect("Index/index");
else
$this->redirect('login','',1,'用户名或密码错误');
}
else{
$this->redirect('login','',1,'验证码错误');
}
}
$this->display();
}
public function verifyImg(){
//设置验证码的宽高字体大小以及验证码的个数,设计其他的参照Think\Verify里面的设置
$config=array(
'imageW' => 150,
'imageH' => 40,
'fontSize' => 20,
'length' => 4
);
$obj = new \Think\Verify($config);
$obj->entry();
}
}表单部分