验证码
2016-04-12 20:26
274 查看
//验证码生成方法 public function img(){ $config = array( 'imageW'=>150, 'imageH'=>40, 'fontSize'=>18, // 验证码字体大小 'length'=>4,// 验证码位数 'useNoise'=>true, // 关闭验证码杂点 ); $Verify = new\Think\Verify($config); $Verify->entry(1); } //静态页面调用验证码生成方法 <<span style="color:#e3e3ff;font-weight:bold;">p> <<span style="color:#e3e3ff;font-weight:bold;">label>验证码</<span style="color:#e3e3ff;font-weight:bold;">label> <<span style="color:#e3e3ff;font-weight:bold;">input class="text-input" type="text" name="code" /> </<span style="color:#e3e3ff;font-weight:bold;">p> <<span style="color:#e3e3ff;font-weight:bold;">div class="clear"></<span style="color:#e3e3ff;font-weight:bold;">div> <<span style="color:#e3e3ff;font-weight:bold;">p> <<span style="color:#e3e3ff;font-weight:bold;">img src="<{:U('Login/img')}>" onclick="JavaScript: this.src+=('?'+Math.random());"> </<span style="color:#e3e3ff;font-weight:bold;">p> //验证码验证 $code=$_POST['code']; $Verify = new\Think\Verify(); $re=$Verify->check($code, $id=1); if(!$re){ $this->error('验证码错误','index',1); }else{ $this->success('验证码正确','Index/index',1); }
相关文章推荐
- 【BZOJ1004】Cards
- WCF服务怎样与宿主程序交互
- whu 1581 Union of cubes
- 2016年腾讯实习生面试技术面一面二面
- C++作业3/3
- 用java实现输出字符串中第一个出现不重复的字符
- 什么是web标准、可用性、可访问性
- STL --- understand
- ACM内部函数--数学问题--最大公约数最小公倍数
- IO瓶颈
- 第七周项目3—用多文件组织多个类的程序
- 数据挖掘:关联规则的apriori算法在weka的源码分析
- c++第四次上机作业
- javascript正则表达式分组-捕获性分组/非捕获性分组/正则前瞻
- 321. Create Maximum Number 解题方法详解
- ★ZZULIoj--1870(枚举好题)
- 软件开发考虑几点
- 登录注销
- Ubuntu12更新重启之后,只在左上角出现一闪一闪的小横杠
- c++第三次实验