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

View File

@@ -1183,16 +1183,19 @@ class Validate
/** /**
* 获取数据值 * 获取数据值
*
* @access protected * @access protected
* @param array $data 数据 * @param array $data
* @param string $key 数据标识 支持二维 * 数据
* @param string $key
* 数据标识 支持二维
* @return mixed * @return mixed
*/ */
protected function getDataValue($data, $key) protected function getDataValue($data, $key)
{ {
if (strpos($key, '.')) { if (strpos($key, '.')) {
// 支持二维数组验证 // 支持二维数组验证
list($name1, $name2) = explode('.', $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 { } else {
$value = is_numeric($key) ? $key : (isset($data[$key]) ? $data[$key] : null); $value = is_numeric($key) ? $key : (isset($data[$key]) ? $data[$key] : null);