1. 程式人生 > >騰訊防水墻(滑動驗證碼)的簡單使用 https://007.qq.com

騰訊防水墻(滑動驗證碼)的簡單使用 https://007.qq.com

tar quick get 對象 console online nbsp target .sh

在線體驗: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