From 1cff11b9cc2548d19180f34a9adf5f72bbd8de73 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 6 Dec 2016 14:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Validate.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/think/Validate.php b/library/think/Validate.php index 3f9b2589..e2b07875 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -408,7 +408,9 @@ class Validate return $message; } elseif (true !== $result) { // 返回自定义错误信息 - $result = str_replace([':attribute', ':rule'], [$title, (string) $rule], $result); + if (is_string($result) && false !== strpos($result, ':')) { + $result = str_replace([':attribute', ':rule'], [$title, (string) $rule], $result); + } return $result; } $i++;