首先

检查是否开启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);

}

}