From 8b463414a4171f75e0620568b1ad9b050865b735 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 20 Dec 2016 14:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bunique=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Validate.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/Validate.php b/library/think/Validate.php index ff9a32ea..dc2457a4 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -11,6 +11,7 @@ namespace think; +use think\exception\ClassNotFoundException; use think\File; use think\Lang; use think\Loader; @@ -817,10 +818,9 @@ class Validate // 指定模型类 $db = new $rule[0]; } else { - $model = Loader::parseClass(Request::instance()->module, 'model', $rule[0]); - if (class_exists($model)) { - $db = new $model; - } else { + try { + $db = Loader::model($rule[0]); + } catch (ClassNotFoundException $e) { $db = Db::name($rule[0]); } }