图片验证码生成失败
$captcha = new CaptchaBuilder("5+8 = ?");
$code = $captcha->getPhrase();
\Cache::put($key, ['phone' => $phone, 'code' => $captcha->getPhrase()], $expiredAt);
$captcha->build();
$result = [
'captcha_key' => $key,
'expired_at' => $expiredAt->toDateTimeString(),
'captcha_image_content' => $captcha->inline()
];
$builder = new CaptchaBuilder(‘12345’)", 其中的 12345 (phrase) 必须为 string
但是这样再使用 $builder->inline() 会报错, 无法生成验证码图片,如上代码即可显示
图片验证码个别符号乱码
if ($font === null) {
$rand = $this->rand(0, 5);
if($rand == 2){
$rand = 3;
}
$font = __DIR__ . '/Font/captcha'.$rand.'.ttf';
// $font = __DIR__ . '/Font/captcha2.ttf';
}