改进验证方法

This commit is contained in:
thinkphp
2018-03-07 18:34:42 +08:00
parent 267c8a5528
commit c8711031a3

View File

@@ -1195,7 +1195,7 @@ class Validate
// 不是正则表达式则两端补上/
$rule = '/^' . $rule . '$/';
}
return 1 === preg_match($rule, (string) $value);
return is_scalar($value) && 1 === preg_match($rule, (string) $value);
}
/**