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中文网
PHP中文网Original
2016-07-28 08:28:061591browse

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 (www.php.cn)!


Statement:
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