首页 > Web开发 > 详细

腾讯防水墙(滑动验证码)的简单使用 https://007.qq.com

时间:2018-09-29 12:55:22      阅读:500      评论:0      收藏:0      [点我收藏+]

在线体验:https://007.qq.com/online.html

快速开始:https://007.qq.com/quick-start.html

简单使用:

1. 引入 JS

<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>

2. 写一个JS方法

// 腾讯防水墙 https://007.qq.com
function submitFormWithCaptcha() {
    // 直接生成一个验证码对象
    var captcha = new TencentCaptcha(‘AppID‘, function (res) {
        console.log(res)
        // res(未通过验证)= {ret: 1, ticket: null}
        // res(验证成功) = {ret: 0, ticket: "String", randstr: "String"}
        if (res.ret === 0) {
                //票据
                //alert(res.ticket)  
                //随机串
                //alert(res.randstr)  
                submitForm();
        } 
    });
    // 显示验证码
    captcha.show(); 
}

3. 页面的某个按钮调用这个方法。

4. 后台方法(略)

 

腾讯防水墙(滑动验证码)的简单使用 https://007.qq.com

原文:https://www.cnblogs.com/anjou/p/9723065.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!