From f4197aecc4d709764c5cc58658f1b9ead2f4b9db Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 27 Dec 2015 22:16:44 +0800 Subject: [PATCH] =?UTF-8?q?model=E7=B1=BBwhere=E6=96=B9=E6=B3=95=E5=BA=9F?= =?UTF-8?q?=E9=99=A4=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=8F=82=E6=95=B0=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3getModelName=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/library/think/model.php b/library/think/model.php index a999879d..88ee896e 100644 --- a/library/think/model.php +++ b/library/think/model.php @@ -1013,7 +1013,7 @@ class Model public function getModelName() { if (empty($this->name)) { - $this->name = substr(get_class($this), 0, -5); + $this->name = basename(get_class($this)); } return $this->name; } @@ -1414,24 +1414,13 @@ class Model } /** - * 指定查询条件 支持安全过滤 + * 指定查询条件 * @access public * @param mixed $where 条件表达式 - * @param mixed $parse 预处理参数 * @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) { $map = []; $map['_string'] = $where;