diff --git a/src/Captcha.php b/src/Captcha.php index f45097b..e3e687c 100644 --- a/src/Captcha.php +++ b/src/Captcha.php @@ -235,7 +235,9 @@ class Captcha // 输出图像 imagepng($this->im); $content = ob_get_clean(); - imagedestroy($this->im); + if (PHP_VERSION_ID < 80000) { + imagedestroy($this->im); + } return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png'); } @@ -338,7 +340,9 @@ class Captcha // Resample $bgImage = @imagecreatefromjpeg($gb); @imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height); - @imagedestroy($bgImage); + if (PHP_VERSION_ID < 80000) { + @imagedestroy($bgImage); + } } /* 加密验证码 */