library tencent-captcha
腾讯验证码
static7/tencent-captcha
腾讯验证码
- Friday, June 22, 2018
- by static7
- Repository
- 1 Watchers
- 2 Stars
- 23 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 64 % Grown
TencentCaptcha
腾讯验证码, (*1)
适合范围
thinkphp5.1.x 专用, (*2)
使用说明
key申请
传送门 https://open.captcha.qq.com/, (*3)
在控制器里, (*4)
//腾讯验证码
$Captcha = new \static7\Captcha(['aid'=>'xxx',''=>'xxxx']);
前端页面配置
我是用的 layui 写的一个测试例子
具体参考页面 https://007.qq.com/captcha/#/gettingStart, (*5)
<form class="layui-form" action="{:Url::build('Example/submit')}" method="post">
//表单代码省略 ...
<div class="layui-form-item">
<div class="layui-input-block">
<input type="hidden" name="ticket" value="">
<input type="hidden" name="randstr" value="">
<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
</div>
</div>
</form>
```javascript 1.6
, (*6)
> 控制器 Example里的 submit 方法
```php
/**
* Submit
* @author staitc7 <static7@qq.com>
* @return mixed
* @throws \think\Exception
*/
public function submit()
{
$param=$this->app->request->param();
$Captcha=new \static7\Captcha();
// 两种方式 一种
// $result=$Captcha->setRandstr($param['randstr'])->setTicket($param['ticket'])->verify();
//或者
$result=$Captcha->verify($param['ticket'],$param['randstr']);
if ((int)$result['response']===0){
return $this->result($param,0,$result['err_msg']);
}
return $this->result($param,1,'成功');
}
dev-master
9999999-dev
腾讯验证码
Sources
Download
MIT
The Requires
by
static7
captcha
static7
v1.3
1.3.0.0
腾讯验证码
Sources
Download
MIT
The Requires
by
static7
captcha
static7
v1.2
1.2.0.0
腾讯验证码
Sources
Download
MIT
The Requires
by
static7
captcha
static7
v1.1
1.1.0.0
腾讯验证码
Sources
Download
MIT
The Requires
by
static7
captcha
static7
v1.0
1.0.0.0
腾讯验证码
Sources
Download
MIT
The Requires
by
static7
captcha
static7