Laravel 验证码

验证码的安装

我们通过 Composer 安装 Captcha 扩展包

composer require mews/captcha

# 可以指定想要安装的版本
composer require mews/captcha:版本号

img

使用配置

使用Captcha服务提供者之前还需要在config/app.php中注册服务提供者:

# 在服务提供者中添加此项

'providers' => [
	MewsCaptchaCaptchaServiceProvider::class,
]

 

# 同时注册下相应门面:
'aliases' => [
  'Captcha' => MewsCaptchaFacadesCaptcha::class,
]

# 发布配置
php artisan vendor:publish

img

img

模板中调用

常用方法
# 返回url
{!! captcha_src() !!}

# 返回 img 的html
{!! captcha_img () !!}

# 生成配置
php artisan vendor:publish

img

img

模板中

img

效果

img

点击更换验证码图片

img

验证码的输入验证

解决验证提示中文

方案1 了解

img

img

img

方案2 推荐

img

效果

img

http://www.h-ui.net/Hui-4.8-alert.shtml h-ui框架手册

原文地址:https://www.cnblogs.com/makalochen/p/14400385.html