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);