php手机邮箱用户名检测类

/ * *  
   2 .   *  Check检测类 
   3 .   * /  
   4 .   Class  Check {  
   5 .  
   6 .   / * *  
   7 .   *  IsUsername函数 : 检测是否符合用户名格式 
   8 .   *  $Argv是要检测的用户名参数 
   9 .   *  $RegExp是要进行检测的正则语句 
  10 .   *  返回值 : 符合用户名格式返回用户名 , 不是返回false 
  11 .   * /  
  12 .  Function IsUsername ( $ Argv ) {  
  13 .  $RegExp = '/^[a-zA-Z0-9_]{3,16}$/' ;   / / 由大小写字母跟数字组成并且长度在3 - 16字符直接 
  14 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  15 .   }  
  16 .  
  17 .   / * *  
  18 .   *  IsMail函数 : 检测是否为正确的邮件格式 
  19 .   *  返回值 : 是正确的邮件格式返回邮件 , 不是返回false 
  20 .   * /  
  21 .  Function IsMail ( $ Argv ) {  
  22 .  $RegExp = '/^[a-z0-9][a-z\.0-9-_]+@[a-z0-9_-]+(?:\.[a-z]{0,3}\.[a-z]{0,2}|\.[a-z]{0,3}|\.[a-z]{0,2})$/i' ;  
  23 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  24 .   }  
  25 .  
  26 .   / * *  
  27 .   *  IsSmae函数 : 检测参数的值是否相同 
  28 .   *  返回值 : 相同返回true , 不相同返回false 
  29 .   * /  
  30 .  Function IsSame ( $ ArgvOne , $ ArgvTwo , $ Force = false ) {  
  31 .  return $Force ? $ ArgvOne = = = $ ArgvTwo : $ ArgvOne = = $ ArgvTwo ;  
  32 .   }  
  33 .  
  34 .   / * *  
  35 .   *  IsQQ函数 : 检测参数的值是否符合QQ号码的格式 
  36 .   *  返回值 : 是正确的QQ号码返回QQ号码 , 不是返回false 
  37 .   * /  
  38 .  Function IsQQ ( $ Argv ) {  
  39 .  $RegExp = '/^[1-9][0-9]{5,11}$/' ;  
  40 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  41 .   }  
  42 .  
  43 .   / * *  
  44 .   *  IsMobile函数 : 检测参数的值是否为正确的中国手机号码格式 
  45 .   *  返回值 : 是正确的手机号码返回手机号码 , 不是返回false 
  46 .   * /  
  47 .  Function IsMobile ( $ Argv ) {  
  48 .  $RegExp = '/^(?:13|15|18)[0-9]{9}$/' ;  
  49 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  50 .   }  
  51 .  
  52 .   / * *  
  53 .   *  IsTel函数 : 检测参数的值是否为正取的中国电话号码格式包括区号 
  54 .   *  返回值 : 是正确的电话号码返回电话号码 , 不是返回false 
  55 .   * /  
  56 .  Function IsTel ( $ Argv ) {  
  57 .  $RegExp = '/[0-9]{3,4}-[0-9]{7,8}$/' ;  
  58 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  59 .   }  
  60 .  
  61 .   / * *  
  62 .   *  IsNickname函数 : 检测参数的值是否为正确的昵称格式 ( Beta )  
  63 .   *  返回值 : 是正确的昵称格式返回昵称格式 , 不是返回false 
  64 .   * /  
  65 .  Function IsNickname ( $ Argv ) {  
  66 .  $RegExp = '/^\s*$|^c:\\con\\con$|[%,\*\"\s\t\<\>\&\'\(\)]|\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8/is' ;   / / Copy  From DZ 
  67 .  return preg_match ( $ RegExp , $ Argv ) ? $ Argv : false ;  
  68 .   }  
  69 .  
  70 .   / * *  
  71 .   *  IsChinese函数 : 检测参数是否为中文 
  72 .   *  返回值 : 是返回参数 , 不是返回false 
  73 .   * /  
  74 .  Function IsChinese ( $ Argv , $ Encoding = 'utf8' ) {  
  75 .  $RegExp  =  $ Encoding = = 'utf8' ? '/^[\x{4e00}-\x{9fa5}]+$/u' : '/^([\x80-\xFF][\x80-\xFF])+$/' ;  
  76 .  Return preg_match ( $ RegExp , $ Argv ) ? $ Argv : False ;  
  77 .   }  
  78 .   }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值