安装步骤:
- 首先,登录网址packagist.org查找
laravel captcha
,找到mews/captcha
,根据packagist上的使用方法一步步来实现验证码的安装。 - composer安装:切换到项目根目录下
composer require mews/captcha
- composer.json多出"mews/captcha":"^2.2"
- 注册
providers (config/app.php)
,在这个数组中的最后追加如下代码:MewsCaptchaCaptchaServiceProvider::class,
- 注册
aliases (config/app.php)
,在这个数组中的最后追加如下代码:'Captcha' => MewsCaptchaFacadesCaptcha::class,
- 生成配置文件,在Composer命令行中输入如下命令:
php artisan vendor:publish
- 进入
config/captcha.php
文件,修改default
数组 可以对验证码进行样式、数量、大小上的修改。
页面中使用:
如果使用这一种:
需要写路由与PHP代码:
LoginController: