Blogger Information
Blog 2
fans 0
comment 0
visits 1622
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
larvael生成图片验证码
一笑红尘我最菜
Original
661 people have browsed it

larvael生成图片验证码

//引用
use Gregwar\Captcha\PhraseBuilder;

use Gregwar\Captcha\CaptchaBuilder;

//代码 
$phrase = new PhraseBuilder;

//生成图片验证码内容
$code = $phrase->build($len);

//生成验证码图片的Builder对象,配置相应属性
$builder = new CaptchaBuilder($code, $phrase);

//可以设置图片宽高及字体
$builder->build($width, $height, $font = null);

//获取验证码的内容
$phrase = $builder->getPhrase();

//把内容存入session
Redis::setex($session_id . 'yzm', 3600, md5(strtolower($phrase)));

//生成图片
header('Content-Type: image/jpeg');
$builder->output();



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post