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


在线体验: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. 后台方法(略)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM