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();