|
发表于 2014-11-19 20:15:28
|
显示全部楼层
本帖最后由 一叶扁舟 于 2014-11-19 20:25 编辑
1,AR模型主要负责SQL拼接,数据检测什么的功能毕竟有限,所以数据必须要经过自己验证再进行数据库操作,不想写数据验证的话CI提供的有验证类
2,再用update函处理set部分时候,数据value都会经过escape函数处理PHP复制代码
public function update ($table = '', $set = NULL, $where = NULL, $limit = NULL)
{
// Combine any cached components with the current statements
$this->_merge_cache ();
if ( ! is_null($set))
{
$this->set($set);
}
。。。。
public function set ($key, $value = '', $escape = TRUE)
{
$key = $this->_object_to_array ($key);
if ( ! is_array($key))
{
$key = array($key => $value);
}
foreach ($key as $k => $v)
{
if ($escape === FALSE)
{
$this->ar_set[$this->_protect_identifiers ($k)] = $v;
}
else
{
$this->ar_set[$this->_protect_identifiers ($k, FALSE, TRUE)] = $this->escape($v);
}
}
return $this;
}
。。。。
function escape ($str)
{
if (is_string($str))
{
$str = "'".$this->escape_str($str)."'";
}
elseif (is_bool($str))
{
$str = ($str === FALSE) ? 0 : 1;
}
elseif (is_null($str))
{
$str = 'NULL';
}
return $str;
}
复制代码
所以第二处错误请自己找自己原因
|
|