当前位置:网站首页>laravel8实现图片验证码
laravel8实现图片验证码
2022-06-25 13:40:00 【陈卿诺语】
1、通过composer安装验证码包
在Composer里执行以下命令
composer require mews/captcha
2、配置
在 config/app.php 中 找到 aliases数组加入以下代码
'Captcha' => Mews\Captcha\CaptchaServiceProvider::class,
3、生成配置文件
在Composer里执行以下命令,如果弹出选项,选择到config,我的config的tag是11,输入11后回车,然后就会在config文件夹里生成配置文件;配置文件里的length是生成验证码多少位;
php artisan vendor:publish
4、前端使用验证码
在需要的地方加入
<img src="{
{captcha_src()}}" id="captcha">
切换验证码
<script>
$('#captcha').click(function(){
$(this).prop('src',"{
{captcha_src()}}"+Math.random(1000,9999));
})
</script>
边栏推荐
- Shell built-in commands
- 腾讯云搭建Socks5多IP代理服务器实现游戏单窗口单IP完美搭建教程附带工具「建议收藏」
- How to configure aliases for typescript + vite projects
- Discriminative v.s.Generative
- 请问通达信股票开户是安全的吗?
- Discriminative v.s.Generative
- Deep parsing and implementation of redis stream advanced message queue [10000 words]
- sigmoid函数sigmoid求导
- Rust,程序員創業的最佳選擇?
- [open source Hongmeng system display] the rk3568 development board is equipped with openharmony 3.1 release
猜你喜欢
随机推荐
112页机器学习-数学基础回顾.pptx
Settings the PC must be turned on
Go--- route filter
Openstack learning notes (I)
Parabolic motion in unity 2D games
Unity 2D游戏中的抛物运动
NR-ARFCN和信道栅格、同步栅格和GSCN
Gorm---- Association query
Scope of ES6 variable
启牛是正规的吗?股票开户安全吗?
Preventing overfitting of deep neural networks (mysteries of neural networks Part II)
深入理解深度神经网络背后的数学(Mysteries of Neural Networks Part I)
Implementation of a small book system
Graph contractual learning with augmentations
Is it unsafe to make new debts
shell 数组
删库跑路、“投毒”、改协议,开源有哪几大红线千万不能踩?
多台云服务器的 Kubernetes 集群搭建
Method for wrapping multiple promise instances into a new promise instance
Discriminative v.s.Generative









