From 66e1411bfe10f97d50a10858ec18f176dbc3878f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B0=8F=E6=98=8E?= <2966980@qq.com> Date: Thu, 31 Mar 2022 08:04:51 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3FormValidates=E7=BA=AF?= =?UTF-8?q?=E5=AD=97=E6=AF=8D=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/library/form/FormValidates.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extend/catcher/library/form/FormValidates.php b/extend/catcher/library/form/FormValidates.php index 57ab31e..59a35ea 100644 --- a/extend/catcher/library/form/FormValidates.php +++ b/extend/catcher/library/form/FormValidates.php @@ -18,7 +18,7 @@ trait FormValidates } /** - * 纯数字验证 + * 纯字母验证 * * @time 2021年03月12日 * @return Validate @@ -28,6 +28,17 @@ trait FormValidates return self::validatePattern('^[A-Za-z]+$')->message('必须为纯字母'); } + /** + * 纯数字验证 + * + * @time 2022年03月31日 + * @return Validate + */ + public static function validateNum(): Validate + { + return self::validatePattern('^\d+$')->message('必须为纯数字'); + } + /** * 字母和数字 *