gscz 2014-10-19 11:23:20 8392次浏览 2条回复 0 0 0

求解答,为什么会挂掉呢??

  • 回复于 2015-01-08 19:44 举报

    《yii 使用验证码组件时,图像因存在错误而无法显》我也撞上了这个问题,求解决。

  • 回复于 2015-04-01 21:32 举报

    试试在CCaptchaAction.php的renderImageGD($code)的末尾部分,输出图像之前,加ob_clean()清空输出缓冲区:

    protected function renderImageGD($code)
    {
             。。。。。。  //省略xxx行
    	imagecolordeallocate($image,$foreColor);
    	ob_clean();  // <================================ 情况输出缓冲区
    	header('Pragma: public');
    	header('Expires: 0');
    	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    	header('Content-Transfer-Encoding: binary');
    	header("Content-Type: image/png");
    	imagepng($image);
    	imagedestroy($image);
    }
    
    3 条回复
    回复于 2016-05-23 10:45 回复

    我也莫名奇妙的突然遇到了这个问题,报图片显示错误,加上这个ob_clean(),问题解决了

    回复于 2016-05-25 00:26 回复

    这是之前的版本的bug,用新的yii2没有这个问题。

    回复于 2016-11-01 18:28 回复

    我用的就是yii2,也是莫名其妙地出现这个问题了呀。

您需要登录后才可以回复。登录 | 立即注册