model类where方法废除第二个参数 修正getModelName方法

This commit is contained in:
thinkphp
2015-12-27 22:16:44 +08:00
parent ae72fd7e10
commit f4197aecc4

View File

@@ -1013,7 +1013,7 @@ class Model
public function getModelName() public function getModelName()
{ {
if (empty($this->name)) { if (empty($this->name)) {
$this->name = substr(get_class($this), 0, -5); $this->name = basename(get_class($this));
} }
return $this->name; return $this->name;
} }
@@ -1414,24 +1414,13 @@ class Model
} }
/** /**
* 指定查询条件 支持安全过滤 * 指定查询条件
* @access public * @access public
* @param mixed $where 条件表达式 * @param mixed $where 条件表达式
* @param mixed $parse 预处理参数
* @return Model * @return Model
*/ */
public function where($where, $parse = null) public function where($where)
{ {
if (!is_null($parse) && is_string($where)) {
if (!is_array($parse)) {
$parse = func_get_args();
array_shift($parse);
}
$parse = array_map([$this->db, 'quote'], $parse);
$where = vsprintf($where, $parse);
} elseif (is_object($where)) {
$where = get_object_vars($where);
}
if (is_string($where) && '' != $where) { if (is_string($where) && '' != $where) {
$map = []; $map = [];
$map['_string'] = $where; $map['_string'] = $where;