生成验证码的时候:

public function verify_c(){
$Verify = new \Think\Verify();
$Verify->fontSize = 18;
$Verify->length = 4;
$Verify->useNoise = false;
$Verify->codeSet = '0123456789';
$Verify->imageW = 130;
$Verify->imageH = 50;
//$Verify->expire = 600;
$Verify->entry();
}

  

<p class="top15 captcha" id="captcha-container">
<input name="verify" width="50%" height="50" class="captcha-text" placeholder="验证码" type="text">
<img width="30%" class="left15" height="50" alt="验证码" src="{:U('Home/Index/verify_c',array())}" title="点击刷新">
</p>

  

    $(function () {
var captcha_img = $('#captcha-container').find('img')
var verifyimg = captcha_img.attr("src");
captcha_img.attr('title', '点击刷新');
captcha_img.click(function(){
if( verifyimg.indexOf('?')>0){
$(this).attr("src", verifyimg+'&random='+Math.random());
}else{
$(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
}
});
})

  验证在common.php中添加方法

function check_verify($code, $id = ""){
$verify = new \Think\Verify();
return $verify->check($code, $id);
}

  提交表单的时候:

$verify = I('param.verify','');
if(!check_verify($verify)){
$this->error("亲,验证码输错了哦!",$this->site_url,9);
}

  

thinkphp3.2 验证码生成和点击刷新验证码的更多相关文章

  1. J2EE如何生成验证码图片和点击刷新验证码

    验证码图片生成步骤 创建BufferedImage对象. 获取BufferedImage的画笔,即调用getGraphics()方法获取Graphics对象. 调用Graphics对象的setColo ...

  2. .net图片验证码生成、点击刷新及验证输入是否正确

    ①创建ValidateCode.aspx,在ValidateCode.aspx.cs中加入如下代码.生成验证码图片,在页面上输出,输出jpeg格式. protected void Page_Load( ...

  3. vue获取后台图片验证码,并点击刷新验证码

    <--url为需要访问的接口地址--> <span style="display: inline-block;width: 130px;height: 53px;borde ...

  4. [oldboy-django][2深入django]点击刷新验证码

    # 点击更新验证码,只要重新在发送一个请求即可 <img src="/check_code/" onclick="updateCode(this);" w ...

  5. Thinkphp5 captcha扩展包安装,验证码验证以及点击刷新

    首先下载 captcha扩展包,↓ 下载附件,解压到vendor目录下: 然后进入application/config.php添加配置信息: //验证码       'captcha'  =>  ...

  6. yourphp点击刷新验证码

    加入css <script type="text/javascript" src="./Public/Js/my.js"></script&g ...

  7. PHP学习笔记(6)js点击刷新验证码

    用“换一张”来控制验证码刷新,js脚本怎么写 宏朋雄 | 浏览 3663 次  2012-06-11 22:41 2012-06-12 01:49   最佳答案   <img src=“验证码文 ...

  8. JavaWeb开发之普通图片验证码生成技术与算术表达式验证码生成技术

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6134649.html    另:算术验证码生成的JSP.Servlet实现均已移植github:https:/ ...

  9. tp5 点击刷新验证码

    <form action="<{:url('index/index/login')}>" method="post" name="f ...

随机推荐

  1. @RequestMapping与controller方法返回值介绍

    @RequestMapping url映射:定义controller方法对应的url,进行处理器映射使用.@RequestMapping(value="/item")或@Reque ...

  2. api 签名算法

    <?php define('token', 'tokensecret'); // 定义私钥token /** * 哈希验证签名 */ function hmacSign($array, $tok ...

  3. Going Home HDU - 1533(最大费用最小流)

    On a grid map there are n little men and n houses. In each unit time, every little man can move one ...

  4. 30.IK分词器配置文件讲解以及自定义词库

    主要知识点: 知道IK默认的配置文件信息 自定义词库     一.ik配置文件     ik配置文件地址:es/plugins/ik/config目录     IKAnalyzer.cfg.xml:用 ...

  5. Problem 29

    Problem 29 Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 仔细看看以下a与b的组合 22=4, 2 ...

  6. hadoop在线退役datanode

    退役dn2echo "dn2" >>excludes echo "dn2" >>yarn-excludes sh refresh-nam ...

  7. cxf 和 httpclient 客户端调用 webservice 接口

    一.cxf 生成 webservice 客户端 1.接口路径 http://ws.webxml.com.cn/WebServices/WeatherWS.asmx 2.进入你需要放置 webservi ...

  8. CodeForcesGym 100735B Retrospective Sequence

    Retrospective Sequence Time Limit: Unknown ms Memory Limit: 65536KB This problem will be judged on C ...

  9. ZOJ 3199 Longest Repeated Substring

    Longest Repeated Substring Time Limit: 5000ms Memory Limit: 32768KB This problem will be judged on Z ...

  10. [cogs736][网络流24题#13]星际转移[网络流,网络判定]

    将一个空间站分为天数个点,每次枚举天数,每增加一天就把对应天数的边连上,用网络流判定可行性,即-判断最大流是否不小于k,注意编号不要错位.通过此题,可见一些网络流题目需要用到网络判定方法,但虽然答案具 ...