mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
@@ -48,6 +48,10 @@ class Validate
|
|||||||
'alphaNum' => ':attribute只能是字母和数字',
|
'alphaNum' => ':attribute只能是字母和数字',
|
||||||
'alphaDash' => ':attribute只能是字母、数字和下划线_及破折号-',
|
'alphaDash' => ':attribute只能是字母、数字和下划线_及破折号-',
|
||||||
'activeUrl' => ':attribute不是有效的域名或者IP',
|
'activeUrl' => ':attribute不是有效的域名或者IP',
|
||||||
|
'chs' => ':attribute只能是汉字',
|
||||||
|
'chsAlpha' => ':attribute只能是汉字、字母',
|
||||||
|
'chsAlphaNum'=> ':attribute只能是汉字、字母和数字',
|
||||||
|
'chsDash' => ':attribute只能是汉字、字母、数字和下划线_及破折号-',
|
||||||
'url' => ':attribute不是有效的URL地址',
|
'url' => ':attribute不是有效的URL地址',
|
||||||
'ip' => ':attribute不是有效的IP地址',
|
'ip' => ':attribute不是有效的IP地址',
|
||||||
'dateFormat' => ':attribute必须使用日期格式 :rule',
|
'dateFormat' => ':attribute必须使用日期格式 :rule',
|
||||||
@@ -516,6 +520,22 @@ class Validate
|
|||||||
// 只允许字母、数字和下划线 破折号
|
// 只允许字母、数字和下划线 破折号
|
||||||
$result = $this->regex($value, '/^[A-Za-z0-9\-\_]+$/');
|
$result = $this->regex($value, '/^[A-Za-z0-9\-\_]+$/');
|
||||||
break;
|
break;
|
||||||
|
case 'chs':
|
||||||
|
// 只允许汉字
|
||||||
|
$result = $this->regex($value, '/^[\x{4e00}-\x{9fa5}]+$/u');
|
||||||
|
break;
|
||||||
|
case 'chsAlpha':
|
||||||
|
// 只允许汉字、字母
|
||||||
|
$result = $this->regex($value, '/^[\x{4e00}-\x{9fa5}a-zA-Z]+$/u');
|
||||||
|
break;
|
||||||
|
case 'chsAlphaNum':
|
||||||
|
// 只允许汉字、字母和数字
|
||||||
|
$result = $this->regex($value, '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u');
|
||||||
|
break;
|
||||||
|
case 'chsDash':
|
||||||
|
// 只允许汉字、字母、数字和下划线_及破折号-
|
||||||
|
$result = $this->regex($value, '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-]+$/u');
|
||||||
|
break;
|
||||||
case 'activeUrl':
|
case 'activeUrl':
|
||||||
// 是否为有效的网址
|
// 是否为有效的网址
|
||||||
$result = checkdnsrr($value);
|
$result = checkdnsrr($value);
|
||||||
|
|||||||
Reference in New Issue
Block a user