This commit is contained in:
thinkphp
2017-03-21 14:34:11 +08:00
parent f5f39422e2
commit 8209f9f4b1

View File

@@ -461,7 +461,8 @@ class Validate
*/
protected function egt($value, $rule, $data)
{
return !is_null($this->getDataValue($data, $rule)) && $value >= $this->getDataValue($data, $rule);
$val = $this->getDataValue($data, $rule);
return !is_null($val) && $value >= $val;
}
/**
@@ -474,7 +475,8 @@ class Validate
*/
protected function gt($value, $rule, $data)
{
return !is_null($this->getDataValue($data, $rule)) && $value > $this->getDataValue($data, $rule);
$val = $this->getDataValue($data, $rule);
return !is_null($val) && $value > $val;
}
/**
@@ -487,7 +489,8 @@ class Validate
*/
protected function elt($value, $rule, $data)
{
return !is_null($this->getDataValue($data, $rule)) && $value <= $this->getDataValue($data, $rule);
$val = $this->getDataValue($data, $rule);
return !is_null($val) && $value <= $val;
}
/**
@@ -500,7 +503,8 @@ class Validate
*/
protected function lt($value, $rule, $data)
{
return !is_null($this->getDataValue($data, $rule)) && $value < $this->getDataValue($data, $rule);
$val = $this->getDataValue($data, $rule);
return !is_null($val) && $value < $val;
}
/**
@@ -1179,8 +1183,8 @@ class Validate
public function getError()
{
return $this->error;
}
}
/**
* 获取数据值
* @access protected
@@ -1193,11 +1197,11 @@ class Validate
if (strpos($key, '.')) {
// 支持二维数组验证
list($name1, $name2) = explode('.', $key);
$value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null;
$value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null;
} else {
$value = is_numeric($key) ? $key : (isset($data[$key]) ? $data[$key] : null);
}
return $value;
return $value;
}
/**