*
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
*@param $str Checked field
*@param $isStr Use
if the only characters in the field may be numbers or bool types
Returns true when empty
*/
function strIsNull($str,$isStr=true)
{
return $isStr?(empty($str)?true:false)
:(isset($str)?false:true);
}
/*
Compare strings with regular expressions
@param $str String to compare
@param $pattern Regular comparison
Returns true
when compared with the regular expression
*/
function strComparePattern($str,$pattern)
{
if(ereg($pattern,$str))
{
// Found return
Return true;
}
return false;
}
/*
Determine the length of a string
@param $str The string to be checked
@param $max maximum length
@param $min minimum length
Returns true if the requirements are met
*/
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 page
@param $page The page to jump to
@param $msg Prompt message
*/
function msg($page,$msg)
{
$msg = empty($msg)?'''''''':"?msg=".base64_encode($msg);
$url=$page.$msg;
if(@header("Location:".$url))
{
echo "";
}
exit();
}
}