From d9093aa8f1ff8798ef1a74fd04b1d677cfd86705 Mon Sep 17 00:00:00 2001 From: F4nniu Date: Sun, 25 Oct 2026 12:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20php8=20=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Captcha.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); + } } /* 加密验证码 */