当前位置:网站首页>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>
边栏推荐
- sql导入这样怎么解决
- Installation and removal of MySQL under Windows
- 历史上的今天:网易成立;首届消费电子展召开;世界上第一次网络直播
- Les neuf caractéristiques de la parole et les neuf temps en anglais
- 哈希表、哈希冲突
- DE2-115 FPGA开发板的VGA显示
- JVM uses tools to analyze classic cases of OOM
- 对白:推荐系统快速入门路线及各知识点总结
- Implementation of a small book system
- On the realization of guessing numbers game
猜你喜欢
随机推荐
历史上的今天:网易成立;首届消费电子展召开;世界上第一次网络直播
Les neuf caractéristiques de la parole et les neuf temps en anglais
Discriminative v.s.Generative
腾讯云搭建Socks5多IP代理服务器实现游戏单窗口单IP完美搭建教程附带工具「建议收藏」
启牛是正规的吗?股票开户安全吗?
Typescript and go --- essence
How does hash eagle, the founder of equity NFT, redefine NFT and use equity to enable long-term value?
Mise en place d'un Cluster kubernets avec plusieurs serveurs Cloud
Vscode--- format setting configuration
Sigmoid function sigmoid derivation
On the simple realization of Sanzi chess game and the method of judging the victory of n-zi chess
Leetcode: Sword finger offer II 091 Painting house [2D DP]
Why should programmers be softer?
Openstack -- creating virtual machines for Nova source code analysis
Preventing overfitting of deep neural networks (mysteries of neural networks Part II)
网络远程访问的方式使用树莓派
Gorm---- Association query
The starting point for learning programming.
What if the CPU temperature of Dell computer is too high
How to determine if a web worker has been created or closed









