phpDocumentor utility
[ class tree: utility ] [ index: utility ] [ all elements ]

Class: WindValidator

Source Location: /utility/WindValidator.php

Class WindValidator

Class Overview

通用验证类

Located in /utility/WindValidator.php [line 11]



		
				Author(s):
		
		
		
Information Tags:
Version:  $Id: WindValidator.php 2973 2011-10-15 19:22:48Z yishuo $
Copyright:  ©2003-2103 phpwind.com
License:  http://www.windframework.com

Methods

[ Top ]
Method Summary
static boolean   hasChinese()   验证是否有中文
static boolean   hasEmail()   验证是否是有合法的email
static boolean   hasHtml()   验证是否有html标记
static boolean   hasIdCard()   验证是否有合法的身份证号
static boolean   hasIpv4()   验证是否有合法的ipv4地址
static boolean   hasIpv6()   验证是否有合法的ipV6
static boolean   hasScript()   验证是否有客户端脚本
static boolean   hasUrl()   验证是否有合法的URL
static boolean   isChinese()   验证是否是中文
static boolean   isEmail()   验证是否是合法的email
static boolean   isHtml()   验证是否是合法的html标记
static boolean   isIdCard()   验证是否是合法的身份证号
static boolean   isIpv4()   验证是否是合法的IP
static boolean   isIpv6()   验证是否是合法的ipV6
static boolean   isLegalLength()   验证字符串的长度
static boolean   isNegative()   验证是否是负数
static boolean   isNonNegative()   验证是否是非负数
static boolean   isPositive()   验证是否是正数
static boolean   isQQ()   验证是否是QQ号码
static boolean   isRequired()   验证是否是不能为空
static boolean   isScript()   验证是否是合法的客户端脚本
static boolean   isTelNumber()   验证是否是手机号码
static boolean   isTelPhone()   验证是否是电话号码
static boolean   isUrl()   验证是否是合法的url
static boolean   isZipcode()   验证是否是邮政编码

[ Top ]
Methods
static method hasChinese  [line 138]

  static boolean hasChinese( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有中文

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasEmail  [line 72]

  static boolean hasEmail( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否是有合法的email

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasHtml  [line 160]

  static boolean hasHtml( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有html标记

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasIdCard  [line 94]

  static boolean hasIdCard( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有合法的身份证号

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasIpv4  [line 182]

  static boolean hasIpv4( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有合法的ipv4地址

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasIpv6  [line 204]

  static boolean hasIpv6( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有合法的ipV6

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasScript  [line 252]

  static boolean hasScript( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有客户端脚本

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method hasUrl  [line 116]

  static boolean hasUrl( string $string, [ &$matches = array()], [boolean $ifAll = false], array $matches  )

验证是否有合法的URL

Parameters:
string   $string:  被搜索的 字符串
array   $matches:  会被搜索的结果,默认为array()
boolean   $ifAll:  是否进行全局正则表达式匹配,默认为false即仅进行一次匹配
   &$matches: 

API Tags:
Return:  如果匹配成功返回true,否则返回false
Access:  public


[ Top ]
static method isChinese  [line 148]

  static boolean isChinese( string $string  )

验证是否是中文

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是中文则返回true,否则返回false
Access:  public


[ Top ]
static method isEmail  [line 82]

  static boolean isEmail( string $string  )

验证是否是合法的email

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是email则返回true,否则返回false
Access:  public


[ Top ]
static method isHtml  [line 170]

  static boolean isHtml( string $string  )

验证是否是合法的html标记

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的html标记则返回true,否则返回false
Access:  public


[ Top ]
static method isIdCard  [line 104]

  static boolean isIdCard( string $string  )

验证是否是合法的身份证号

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的身份证号则返回true,否则返回false
Access:  public


[ Top ]
static method isIpv4  [line 192]

  static boolean isIpv4( string $string  )

验证是否是合法的IP

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的IP则返回true,否则返回false
Access:  public


[ Top ]
static method isIpv6  [line 227]

  static boolean isIpv6( string $string  )

验证是否是合法的ipV6

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的ipV6则返回true,否则返回false
Access:  public


[ Top ]
static method isLegalLength  [line 314]

  static boolean isLegalLength( string $string, string $length, [string $charset = 'utf8']  )

验证字符串的长度

Parameters:
string   $string:  要验证的字符串
string   $length:  指定的合法的长度
string   $charset:  字符编码默认为utf-8编码

API Tags:
Return:  如果长度大于给定的长度则返回true,否则返回false
Access:  public


[ Top ]
static method isNegative  [line 292]

  static boolean isNegative( int $number  )

验证是否是负数

Parameters:
int   $number:  需要被验证的数字

API Tags:
Return:  如果数字小于于0则返回true否则返回false
Access:  public


[ Top ]
static method isNonNegative  [line 272]

  static boolean isNonNegative( int $number  )

验证是否是非负数

Parameters:
int   $number:  需要被验证的数字

API Tags:
Return:  如果大于等于0的整数数字返回true,否则返回false
Access:  public


[ Top ]
static method isPositive  [line 282]

  static boolean isPositive( int $number  )

验证是否是正数

Parameters:
int   $number:  需要被验证的数字

API Tags:
Return:  如果数字大于0则返回true否则返回false
Access:  public


[ Top ]
static method isQQ  [line 48]

  static boolean isQQ( string $qq  )

验证是否是QQ号码

QQ号码必须是以1-9的数字开头,并且长度5-15为的数字串

Parameters:
string   $qq:  待验证的qq号码

API Tags:
Return:  如果验证成功返回true,否则返回false
Access:  public


[ Top ]
static method isRequired  [line 302]

  static boolean isRequired( mixed $value  )

验证是否是不能为空

Parameters:
mixed   $value:  待判断的数据

API Tags:
Return:  如果为空则返回false,不为空返回true
Access:  public


[ Top ]
static method isScript  [line 262]

  static boolean isScript( string $string  )

验证是否是合法的客户端脚本

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的客户端脚本则返回true,否则返回false
Access:  public


[ Top ]
static method isTelNumber  [line 36]

  static boolean isTelNumber( string $number  )

验证是否是手机号码

国际区号-手机号码

Parameters:
string   $number:  待验证的号码

API Tags:
Return:  如果验证失败返回false,验证成功返回true
Access:  public


[ Top ]
static method isTelPhone  [line 24]

  static boolean isTelPhone( string $phone  )

验证是否是电话号码

国际区号-地区号-电话号码的格式(在国际区号前可以有前导0和前导+号), 国际区号支持0-4位 地区号支持0-6位 电话号码支持4到12位

Parameters:
string   $phone:  被验证的电话号码

API Tags:
Return:  如果验证通过则返回true,否则返回false
Access:  public


[ Top ]
static method isUrl  [line 126]

  static boolean isUrl( string $string  )

验证是否是合法的url

Parameters:
string   $string:  待验证的字串

API Tags:
Return:  如果是合法的url则返回true,否则返回false
Access:  public


[ Top ]
static method isZipcode  [line 60]

  static boolean isZipcode( string $zipcode  )

验证是否是邮政编码

邮政编码是4-8个长度的数字串

Parameters:
string   $zipcode:  待验证的邮编

API Tags:
Return:  如果验证成功返回true,否则返回false
Access:  public


[ Top ]

Documentation generated on Fri, 30 Mar 2012 11:43:43 +0800 by phpDocumentor 1.4.4