格式规范

This commit is contained in:
lilwil
2017-03-20 14:20:10 +08:00
parent b2e59eb4c7
commit 552d564cd6

View File

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