Class: WindValidator
Source Location: /utility/WindValidator.php
Class WindValidator
Method Summary
static
boolean
|
hasEmail() |
验证是否是有合法的email |
static
boolean
|
hasHtml() |
验证是否有html标记 |
static
boolean
|
hasIpv4() |
验证是否有合法的ipv4地址 |
static
boolean
|
hasIpv6() |
验证是否有合法的ipV6 |
static
boolean
|
hasUrl() |
验证是否有合法的URL |
static
boolean
|
isEmail() |
验证是否是合法的email |
static
boolean
|
isHtml() |
验证是否是合法的html标记 |
static
boolean
|
isIpv4() |
验证是否是合法的IP |
static
boolean
|
isIpv6() |
验证是否是合法的ipV6 |
static
boolean
|
isQQ() |
验证是否是QQ号码 |
static
boolean
|
isUrl() |
验证是否是合法的url |
Methods
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
static boolean isChinese(
string
$string
)
|
|
验证是否是中文
Parameters:
API Tags:
Return: | 如果是中文则返回true,否则返回false |
Access: | public |
static boolean isEmail(
string
$string
)
|
|
验证是否是合法的email
Parameters:
API Tags:
Return: | 如果是email则返回true,否则返回false |
Access: | public |
static boolean isHtml(
string
$string
)
|
|
验证是否是合法的html标记
Parameters:
API Tags:
Return: | 如果是合法的html标记则返回true,否则返回false |
Access: | public |
static boolean isIdCard(
string
$string
)
|
|
验证是否是合法的身份证号
Parameters:
API Tags:
Return: | 如果是合法的身份证号则返回true,否则返回false |
Access: | public |
static boolean isIpv4(
string
$string
)
|
|
验证是否是合法的IP
Parameters:
API Tags:
Return: | 如果是合法的IP则返回true,否则返回false |
Access: | public |
static boolean isIpv6(
string
$string
)
|
|
验证是否是合法的ipV6
Parameters:
API Tags:
Return: | 如果是合法的ipV6则返回true,否则返回false |
Access: | public |
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 |
static boolean isNegative(
int
$number
)
|
|
验证是否是负数
Parameters:
API Tags:
Return: | 如果数字小于于0则返回true否则返回false |
Access: | public |
static boolean isNonNegative(
int
$number
)
|
|
验证是否是非负数
Parameters:
API Tags:
Return: | 如果大于等于0的整数数字返回true,否则返回false |
Access: | public |
static boolean isPositive(
int
$number
)
|
|
验证是否是正数
Parameters:
API Tags:
Return: | 如果数字大于0则返回true否则返回false |
Access: | public |
static boolean isQQ(
string
$qq
)
|
|
验证是否是QQ号码
QQ号码必须是以1-9的数字开头,并且长度5-15为的数字串
Parameters:
API Tags:
Return: | 如果验证成功返回true,否则返回false |
Access: | public |
static boolean isRequired(
mixed
$value
)
|
|
验证是否是不能为空
Parameters:
API Tags:
Return: | 如果为空则返回false,不为空返回true |
Access: | public |
static boolean isScript(
string
$string
)
|
|
验证是否是合法的客户端脚本
Parameters:
API Tags:
Return: | 如果是合法的客户端脚本则返回true,否则返回false |
Access: | public |
static boolean isTelNumber(
string
$number
)
|
|
验证是否是手机号码
国际区号-手机号码
Parameters:
API Tags:
Return: | 如果验证失败返回false,验证成功返回true |
Access: | public |
static boolean isTelPhone(
string
$phone
)
|
|
验证是否是电话号码
国际区号-地区号-电话号码的格式(在国际区号前可以有前导0和前导+号), 国际区号支持0-4位 地区号支持0-6位 电话号码支持4到12位
Parameters:
API Tags:
Return: | 如果验证通过则返回true,否则返回false |
Access: | public |
static boolean isUrl(
string
$string
)
|
|
验证是否是合法的url
Parameters:
API Tags:
Return: | 如果是合法的url则返回true,否则返回false |
Access: | public |
static boolean isZipcode(
string
$zipcode
)
|
|
验证是否是邮政编码
邮政编码是4-8个长度的数字串
Parameters:
API Tags:
Return: | 如果验证成功返回true,否则返回false |
Access: | public |
|
|