騰訊防水牆(滑動驗證碼)的簡單使用 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