mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进requireIf requireWith requireCallback验证规则及内置错误提示
This commit is contained in:
@@ -900,7 +900,7 @@ class Validate
|
||||
{
|
||||
list($field, $val) = explode(',', $rule);
|
||||
if ($this->getDataValue($data, $field) == $val) {
|
||||
return !empty($value);
|
||||
return !empty($value) || '0' == $value;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -918,7 +918,7 @@ class Validate
|
||||
{
|
||||
$result = call_user_func_array($rule, [$value, $data]);
|
||||
if ($result) {
|
||||
return !empty($value);
|
||||
return !empty($value) || '0' == $value;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -936,7 +936,7 @@ class Validate
|
||||
{
|
||||
$val = $this->getDataValue($data, $rule);
|
||||
if (!empty($val)) {
|
||||
return !empty($value);
|
||||
return !empty($value) || '0' == $value;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -1226,6 +1226,8 @@ class Validate
|
||||
$msg = $this->message[$attribute];
|
||||
} elseif (isset(self::$typeMsg[$type])) {
|
||||
$msg = self::$typeMsg[$type];
|
||||
} elseif (0 === strpos($type, 'require')) {
|
||||
$msg = self::$typeMsg['require'];
|
||||
} else {
|
||||
$msg = $title . '规则错误';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user