In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how Laravel8.5 adds CAPTCHA mews/captcha, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article. Let's take a look at it.
1. Install the verification code package through composer
Execute the following command in Composer
Composer require mews/captcha2, configuration
Find the aliases array in config/app.php and add the following code
'Captcha' = > Mews\ Captcha\ CaptchaServiceProvider::class,3, generate configuration file
Execute the following command in Composer. If the pop-up option is selected to config, the tag of my config is 11. Enter 11 and enter, and then the configuration file will be generated in the config folder. How many bits of verification code will be generated by length in the configuration file?
Php artisan vendor:publish4, use CAPTCHA at the front end
Join where needed
If you are using vue.js. You can do this.
/ * html part * /
/ * js part * / new Vue ({el: '.main', data: {urlCode: ",}, created () {this.getCode ();}, methods: {getCode () {let domain = document.domain; $.get ('http://'+domain+'/getCode',(res)=>{ this.urlCode = res.code) })}, goLogin () {_ document.onkeyup = (event) = > {let e = event | | window.event; if (e & & e.keyCode==13) {/ / execute login}} 5. The controller generates the verification code public function codes () {return response ()-> json (['code' = >\ captcha_src () / / returns the front-end image verification code]);} 6. Verification code verification if (! captcha_check ($params [' code'])) {return Response ()-> json (['code' = > 201,' msg' = > 'verification code']) } Thank you for reading this article carefully. I hope the article "how to add CAPTCHA mews/captcha to Laravel8.5" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.