Php string check class. * String check class * @ authorsanshiQQ: 35047205 Email: sanshi0815@tom.comMSN: sanshi0815@tom.com * classcheckBase {functioncheckBase () {}* used to check whether the string is empty *
String check class
* @ Author sanshi
QQ: 35047205
Email: sanshi0815@tom.com
MSN: sanshi0815@tom.com
*/
Class checkBase
{
Function checkBase ()
{
}
/*
Used to check whether the string is null
* @ Param $ str check Field
* @ Param $ isStr if the field may have unique characters of the number or bool type
Returns true if it is null.
*/
Function strIsNull ($ str, $ isStr = true)
{
Return $ isStr? (Empty ($ str )? True: false)
:( Isset ($ str )? False: true );
}
/*
Comparison between string and regular expression
@ Param $ str string to be compared
@ Param $ regular expression to be compared with pattern
Returns true when compared with the regular expression.
*/
Function strComparePattern ($ str, $ pattern)
{
If (ereg ($ pattern, $ str ))
{
// Return is found
Return true;
}
Return false;
}
/*
Judge the length of a string
@ Param $ str the string to be checked
@ Param $ max maximum length
@ Param $ min minimum length
Returns true if it meets the requirements.
*/
Function strCompareLen ($ str, $ max, $ min = 1)
{
$ Len = strlen ($ str );
$ Max = empty ($ max )? $ Len: $ max;
Return ($ len> $ max | $ len <$ min )? False: true;
}
/*
Information Processing, jump to the page
@ Param $ page the page to jump
@ Param $ msg prompt information
*/
Function msg ($ page, $ msg)
{
$ Msg = empty ($ msg )? '''''''':"? Msg = ". base64_encode ($ msg );
$ Url = $ page. $ msg;
If (@ header ("Location:". $ url ))
{
Echo" ";
}
Exit ();
}
}
Handler string check class * @ author sanshi QQ: 35047205 Email: sanshi0815@tom.com MSN: sanshi0815@tom.com */class checkBase {function checkBase () {}/ * used to check whether the string is empty...