xuezhitech / tp6-captcha
captcha package for thinkphp6
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/xuezhitech/tp6-captcha
Requires
- topthink/framework: ^6.0
This package is auto-updated.
Last update: 2025-10-10 07:31:53 UTC
README
thinkphp6 验证码类库
安装
composer require xuezhitech/tp6-captcha
使用
在控制器中输出验证码
在控制器的操作方法中使用
声明
use xuezhitech/tp6-captcha;
使用
public function captcha()
{
$config = [
'useCurve'=>false,
'codeSet'=>'123456789',
];
$captcha = new Captcha($config);
return $captcha->create();
}
然后注册对应的路由来输出验证码
控制器里验证
验证
//验证码是否正确
$captcha = new Captcha();
if ( !$captcha->check($key,$code) ){
return json('CAPTCHA_CODE_ERROR');
}