Laravel验证码

先确保PHP扩展 

php_gd2.dll

 

 

php_fileinfo.dll

 


这两个扩展开启

然后跑这个命令

composer require mews/captcha

 


接着配置

'providers' => [
    // ...
    Mews\Captcha\CaptchaServiceProvider::class,
]

 

 

'aliases' => [
    // ...
    'Captcha' => Mews\Captcha\Facades\Captcha::class,
]

 


$ php artisan vendor:publish

这里的0表示安装所有的 

 

config/captcha.php

return [ 'default' => [ 'length' => 5, 'width' => 120, 'height' => 36, 'quality' => 90, ], // ... ];

 


最后用这个

captcha_src();

 


就可以显示验证码了

 

posted @ 2018-03-19 23:43  caking  阅读(162)  评论(0)    收藏  举报