改进Validate类的image验证规则

This commit is contained in:
thinkphp
2016-07-18 15:26:09 +08:00
parent a4600c8032
commit 1bc85bb5be

View File

@@ -547,7 +547,7 @@ class Validate
$result = $value instanceof \think\File; $result = $value instanceof \think\File;
break; break;
case 'image': case 'image':
$result = $value instanceof \think\File && exif_imagetype($value->getRealPath()); $result = $value instanceof \think\File && in_array(exif_imagetype($value->getRealPath()), [1, 2, 3, 6]);
break; break;
default: default:
if (isset(self::$type[$rule])) { if (isset(self::$type[$rule])) {