Usage of graphical verification code for laravel framework learning
The components of the next graphical verification code
composer require gregwar/captcha=1.*
In the controller
use Gregwar\Captcha\CaptchaBuilder; public function xxx(Request $request){ $builder = new CaptchaBuilder; $builder->build(); $bb = $builder->inline(); //获取图形验证码的url $request->session()->put('piccode', $builder->getPhrase()); //将图形验证码的值写入到session中 return view('abc',["bb"=>$bb]); }
In the template
<img src="{{$bb}}" name="imgc" id="imgc" alt="换一张" class="get-code" height="36" width="80">
The above is the use of graphical verification code for laravel framework learning ( 4). For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!