jbrathod/math-captcha

在单个网站上使用多次的验证码

安装: 19

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:项目

dev-main 2022-08-02 09:35 UTC

This package is not auto-updated.

Last update: 2024-09-24 23:28:12 UTC


README

将在单个网站中的多个页面/位置使用的一个验证码。

安装指南

composer require jbrathod/math-captcha

config/app.php 中找到 providers 键并注册 Captcha 服务提供者。

    'providers' => [
        // ...
        'Jbrathod\MathCaptcha\MathCaptchaServiceProvider',
    ]

对于 Laravel 5.1+

    'providers' => [
        // ...
        Jbrathod\MathCaptcha\MathCaptchaServiceProvider::class,
    ]

用法

将验证码图片添加到表单中(注意:“contact-us”是页面名称)

<img src="{{ app('mathcaptcha')->image('contact-us') }}"/>

验证验证码

'captcha' => 'required|mathcaptcha:contact-us' 添加到规则数组中。

$this->validate($request, [
    'captcha' => 'required|mathcaptcha:contact-us',
]);

在表单提交无错误后重置验证码

app('mathcaptcha')->reset('contact-us');