mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进confirm验证规则 支持 password 及 password_confirm 自动规则识别
This commit is contained in:
@@ -422,13 +422,21 @@ class Validate
|
|||||||
/**
|
/**
|
||||||
* 验证是否和某个字段的值一致
|
* 验证是否和某个字段的值一致
|
||||||
* @access protected
|
* @access protected
|
||||||
* @param mixed $value 字段值
|
* @param mixed $value 字段值
|
||||||
* @param mixed $rule 验证规则
|
* @param mixed $rule 验证规则
|
||||||
* @param array $data 数据
|
* @param array $data 数据
|
||||||
|
* @param string $field 字段名
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function confirm($value, $rule, $data)
|
protected function confirm($value, $rule, $data, $field)
|
||||||
{
|
{
|
||||||
|
if ('' == $rule) {
|
||||||
|
if (strpos($field, '_confirm')) {
|
||||||
|
$rule = strstr($field, '_confirm', true);
|
||||||
|
} else {
|
||||||
|
$rule = $field . '_confirm';
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->getDataValue($data, $rule) == $value;
|
return $this->getDataValue($data, $rule) == $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user