From 8209f9f4b1d406e5f5eeb800ce70c406117ceba3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 21 Mar 2017 14:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Validate.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/library/think/Validate.php b/library/think/Validate.php index ca425496..c258df88 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -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; } /**