captcha字体存在问题

forwebreg

问题描述

这里写描述
使用算数的时候 加号和等于符号部分字体加载不正常
截图

程序代码或配置

    /**
     * 验证码
     */
    public function verifyImg($hashid = '0000', $math = false)
    {
        $builder = new CaptchaBuilder(); // 初始化验证码类
        $builder->setBackgroundColor(255, 255, 255);
        if ($math) {
            $x   = random_int(10, 30);
            $y   = random_int(1, 9);
            $phrase = "{$x} + {$y} = ";
            $builder->setPhrase($phrase);
            $result = $x + $y;
        }
        $builder->setDistortion(false);
        $builder->setMaxBehindLines(0);
        $builder->setMaxFrontLines(0);
        $builder->build(); // 生成验证码
        Cache::set('captcha_' . $hashid, $math ? $result : strtolower($builder->getPhrase()), 900); // 缓存验证码数据
        $img_content = $builder->get(); // 获得验证码图片二进制数据
        return response($img_content, 200, ['Content-Type' => 'image/jpeg']); // 输出验证码二进制数据
    }
214 1 0
1个回答

walkor

升级下
composer require webman/captcha ^1.0.4

  • 暂无评论
×
🔝