您的位置:首页 > 理论基础 > 计算机网络

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

2019-08-10 18:22 2675 查看

本文转载于:猿2048网站https://www.mk2048.com/blog/blog.php?id=h0b1j&title=%E8%85%BE%E8%AE%AF%E9%98%B2%E6%B0%B4%E5%A2%99%28%E6%BB%91%E5%8A%A8%E9%AA%8C%E8%AF%81%E7%A0%81%29%E7%9A%84%E7%AE%80%E5%8D%95%E4%BD%BF%E7%94%A8+https%3A%2F%2F007.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. 后台方法(略)

 

本文转载于:https://www.mk2048.com/blog/blog.php?id=h0b1j&title=%E8%85%BE%E8%AE%AF%E9%98%B2%E6%B0%B4%E5%A2%99%28%E6%BB%91%E5%8A%A8%E9%AA%8C%E8%AF%81%E7%A0%81%29%E7%9A%84%E7%AE%80%E5%8D%95%E4%BD%BF%E7%94%A8+https%3A%2F%2F007.qq.com

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: