From 93e0eb46d3e2fd80ad5c936bfb012b1adbef2145 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 11 Sep 2016 14:25:13 +0800 Subject: [PATCH] =?UTF-8?q?Validate=E7=B1=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Validate.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/library/think/Validate.php b/library/think/Validate.php index 471bb150..5fa15424 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -11,6 +11,7 @@ namespace think; +use think\File; use think\Request; use think\Session; @@ -562,10 +563,10 @@ class Validate $result = is_array($value); break; case 'file': - $result = $value instanceof \think\File; + $result = $value instanceof File; break; case 'image': - $result = $value instanceof \think\File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6]); + $result = $value instanceof File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6]); break; case 'token': $result = $this->token($value, '__token__', $data); @@ -629,7 +630,7 @@ class Validate */ protected function fileExt($file, $rule) { - if (!($file instanceof \think\File)) { + if (!($file instanceof File)) { return false; } if (is_string($rule)) { @@ -656,7 +657,7 @@ class Validate */ protected function fileMime($file, $rule) { - if (!($file instanceof \think\File)) { + if (!($file instanceof File)) { return false; } if (is_string($rule)) { @@ -683,7 +684,7 @@ class Validate */ protected function fileSize($file, $rule) { - if (!($file instanceof \think\File)) { + if (!($file instanceof File)) { return false; } if (is_array($file)) { @@ -707,7 +708,7 @@ class Validate */ protected function image($file, $rule) { - if (!($file instanceof \think\File)) { + if (!($file instanceof File)) { return false; } $rule = explode(',', $rule); @@ -946,7 +947,7 @@ class Validate { if (is_array($value)) { $length = count($value); - } elseif ($value instanceof \think\File) { + } elseif ($value instanceof File) { $length = $value->getSize(); } else { $length = mb_strlen((string) $value); @@ -973,7 +974,7 @@ class Validate { if (is_array($value)) { $length = count($value); - } elseif ($value instanceof \think\File) { + } elseif ($value instanceof File) { $length = $value->getSize(); } else { $length = mb_strlen((string) $value); @@ -992,7 +993,7 @@ class Validate { if (is_array($value)) { $length = count($value); - } elseif ($value instanceof \think\File) { + } elseif ($value instanceof File) { $length = $value->getSize(); } else { $length = mb_strlen((string) $value);