phphleb / ucaptcha
通用验证码
dev-main
2024-01-29 15:02 UTC
Requires
- php: >7.0.0
- ext-gd: *
This package is auto-updated.
Last update: 2024-09-29 16:36:32 UTC
README
通用验证码
使用Composer安装
$ composer require phphleb/ucaptcha
第一步. 创建图像(显示PNG)。
第一步. 创建图像(显示PNG)。
(new \Phphleb\Ucaptcha\Captcha())->createImage(\Phphleb\Ucaptcha\Captcha::TYPE_BASE);
第二步. 检查用户输入的代码。
第二步. 检查用户输入的代码。
if ((new \Phphleb\Ucaptcha\Captcha())->check($code)) { // Characters entered correctly. } else { // Invalid characters. };
检查当前用户会话中验证码的成功完成。
检查当前用户会话中验证码的成功完成。
if ((new \Phphleb\Ucaptcha\Captcha())->isPassed()) { // The captcha has already been completed earlier. }