From 26031781958a70ef77e14b7098e71e9204552b54 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 21 Mar 2016 14:47:39 +0800 Subject: [PATCH] =?UTF-8?q?validate=E7=9A=84=E5=9C=BA=E6=99=AF=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BD=BF=E7=94=A8=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=88=E6=94=AF=E6=8C=81=E9=97=AD=E5=8C=85=EF=BC=89=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=9B=BA=E5=AE=9A=E7=9A=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Validate.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/Validate.php b/library/think/Validate.php index 486e16d0..3fe5153f 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -256,9 +256,14 @@ class Validate $title = $key; } // 场景检测 - if (!empty($scene) && !in_array($key, $scene)) { - continue; + if (!empty($scene)) { + if ($scene instanceof \Closure && call_user_func_array($scene, [$key, &$data])) { + continue; + } elseif (is_array($scene) && !in_array($key, $scene)) { + continue; + } } + // 获取数据 支持二维数组 $value = $this->getDataValue($data, $key);