老张博客

thinkphp5 按照手册上操作后 验证码不显示

发布时间:2018-12-27 14:55:49热度: 7213 ℃评论数:

首先

检查是否开启gd库

如果确认GD库已经开启


清除缓冲区就应该可以了,

解决的办法是在vendor/topthink/think-captcha/CaptchaController.php中加上这个ob_clean();就可以了,


修改后的代码如下:

class CaptchaController

{

    public function index($id = "")

    {

    ob_clean();      //清除缓存 自己添加

        $captcha = new Captcha((array)Config::get('captcha'));

        return $captcha->entry($id);

    }

}



按照,手册,验证码

手机扫码访问