From 05c79188ccc3c73c7351e5a0f694cfe01b7e82da Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 17 Feb 2023 21:18:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Rules/Domain.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Rules/Domain.php b/app/Rules/Domain.php index e79763a..7d92c34 100644 --- a/app/Rules/Domain.php +++ b/app/Rules/Domain.php @@ -15,8 +15,7 @@ class Domain implements Rule */ public function passes($attribute, $value): bool { - // 验证域名是否合法 - return preg_match('/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/', $value); + return filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) !== false; } /**