TP5 在云服务器下 验证码不显示的解决方案

tp5使用 think-captcha 后,本地环境正常的显示,可放到云服务器上却显示不了。

方法其实很简单,在 vendor/topthink/think-captcha/src/CaptchaController.php中加上这个ob_clean();这样就能够清除缓存区

namespace think\captcha;

use think\Config;

class CaptchaController
{
    public function index($id = "")
    {
        $captcha = new Captcha((array)Config::get('captcha'));
       ob_clean();
        return $captcha->entry($id);
    }
}

用此即可解决验证码不出来的问题。

猜你喜欢

转载自www.cnblogs.com/whs5280/p/11324103.html
今日推荐