模型过滤问题

浏览:936 发布日期:2016/03/23
5.0.0 - 普通 - 未处理
$fields = $this->getFields();
// 检查非数据字段
if (!empty($fields)) {
foreach ($data as $key => $val) {
if (!in_array($key, $fields, true)) {
if (Config::get('db_fields_strict')) {
throw new Exception(' fields not exists :[ ' . $key . ' ]');
}
unset($data[$key]);
} elseif (is_scalar($val) && !isset($this->options['bind'][$key])) {
// 字段类型检查
$this->_parseType($data, $key, $this->options['bind']);
}
}
}
// 安全过滤
if (!empty($this->options['filter'])) {
$data = array_map($this->options['filter'], $data);
unset($this->options['filter']);
}

这里检查非数据字段后还没到安全过滤就报错了,过滤到底咋用??
评论(
后面还有条评论,点击查看>>