改进自定义错误信息的判断

This commit is contained in:
thinkphp
2016-12-06 14:07:08 +08:00
parent 4ebd16f8ef
commit 1cff11b9cc

View File

@@ -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++;