This commit is contained in:
lilwil
2017-03-20 14:17:50 +08:00
parent f439a84165
commit b2e59eb4c7

View File

@@ -1179,25 +1179,28 @@ class Validate
public function getError() public function getError()
{ {
return $this->error; return $this->error;
} }
/** /**
* 获取数据值 * 获取数据值
* @access protected *
* @param array $data 数据 * @access protected
* @param string $key 数据标识 支持二维 * @param array $data
* @return mixed * 数据
*/ * @param string $key
protected function getDataValue($data, $key) * 数据标识 支持二维
{ * @return mixed
if (strpos($key, '.')) { */
// 支持二维数组验证 protected function getDataValue($data, $key)
list($name1, $name2) = explode('.', $key); {
$value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null; if (strpos($key, '.')) {
// 支持二维数组验证
list ($name1, $name2) = explode('.', $key);
$value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null;
} else { } else {
$value = is_numeric($key) ? $key : (isset($data[$key]) ? $data[$key] : null); $value = is_numeric($key) ? $key : (isset($data[$key]) ? $data[$key] : null);
} }
return $value; return $value;
} }
/** /**