thinkPHP实现的验证码登录功能示例
发布时间:2020-12-14 14:09:27 所属栏目:大数据 来源:网络整理
导读:本篇章节讲解thinkPHP实现的验证码登录功能。供大家参考研究具体如下: 使用thinkphp自带的验证,实现登录页面的账号密码+验证码的验证 check(I('post.yanzhengma','','trim'))){ // 注释部分为另外一种从数据库中验证密码的方法 // $data['name']
本篇章节讲解thinkPHP实现的验证码登录功能。分享给大家供大家参考,具体如下: 使用thinkphp自带的验证,实现登录页面的账号密码+验证码的验证 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','验证码错误');
}
}
$this->display();
}
public function verifyImg(){
//设置验证码的宽高字体大小以及验证码的个数,设计其他的参照ThinkVerify里面的设置
$config=array(
'imageW' => 150,'imageH' => 40,'fontSize' => 20,'length' => 4
);
$obj = new ThinkVerify($config);
$obj->entry();
}
}
表单部分 |
相关内容
- 大数据思维分享世界杯商业盛宴
- 【bzoj1670】[Usaco2006 Oct]Building the Moat护城河的挖掘
- vb.net – 本地化.NET;使用ResourceManager时的后备语言
- Grails with ATS Transformation tutorial with a demo exa
- DELPHI生成32位随机字符串(数字和大写字母混合)
- delphi – 如何从父类调用子类构造函数?
- HDU3966 Aragorn's Story 树链剖分
- Delphi XE7 学习笔记 StopWatch类
- Django踩坑记录2
- delphi – 为什么TObject.AfterConstruction和BeforeConstr