thinkPHP实现的验证码登录功能示例
2018-06-22 00:58:46来源:未知 阅读 ()
本文实例讲述了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','',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(); } }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- PHP写UltraEdit插件脚本实现方法 2020-03-29
- ThinkPHP3.1.x修改成功与失败跳转页面的方法 2020-03-22
- PHP实现的MD5结合RSA签名算法实例 2020-03-22
- 利用PHP实现开心消消乐的算法示例 2020-03-22
- PHP基于自定义函数实现的汉字转拼音功能实例 2020-03-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash