From 909f494af73287ce8658c0a4c6b10e897fbc13bf Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 4 Nov 2016 19:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3File=E7=B1=BBcheckImg?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/File.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/File.php b/library/think/File.php index 0d04bec1..60a16417 100644 --- a/library/think/File.php +++ b/library/think/File.php @@ -230,10 +230,10 @@ class File extends SplFileObject { $extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION)); /* 对图像文件进行严格检测 */ - if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && in_array($this->getImageType($this->filename), [1, 2, 3, 4, 6])) { - return true; + if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array($this->getImageType($this->filename), [1, 2, 3, 4, 6])) { + return false; } - return false; + return true; } // 判断图像类型