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

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

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

简单使用:spa

1. 引入 JScode

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

2. 写一个JS方法orm

// 腾讯防水墙 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. 页面的某个按钮调用这个方法。htm

4. 后台方法(略)对象

相关文章
相关标签/搜索