Home > Backend Development > PHP Tutorial > The use of graphical verification codes for laravel framework learning (4)

The use of graphical verification codes for laravel framework learning (4)

PHP中文网
Release: 2016-07-28 08:28:06
Original
1571 people have browsed it

Usage of graphical verification code for laravel framework learning

The components of the next graphical verification code

composer require gregwar/captcha=1.*
Copy after login

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]);
   }
Copy after login

In the template

 <img src="{{$bb}}" name="imgc" id="imgc" alt="换一张" class="get-code" height="36" width="80">
Copy after login

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)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template