*
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 the fields $str check
* @param $isStr If the field has the possibility that the unique character is a number or bool type, use the
Returns True when empty
*/
function Strisnull ($str, $isStr =true)
{
Return $ISSTR? (Empty ($STR) true:false)
:(Isset ($STR) false:true);
}
/*
strings are compared to regular expressions
@param $str the string to compare
@param $pattern is better than right.
Returns true on a positive alignment
*/
function Strcomparepattern ($STR, $pattern)
{
if (Ereg ($pattern, $STR))
{
Found the return
return true;
}
return false;
}
/*
Judge the length of a string
@param $str the string to check
Maximum length of @param $max
Minimum length of @param $min
return true for compliance 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 Jump to the page
@param $msg Hint Information
*/
function msg ($page, $msg)
{
$msg = Empty ($msg) "", "msg=". Base64_encode ($MSG);
$url = $page. $msg;
if (@header ("Location:". $url))
{
echo "<meta http-equiv=refresh content=" "0;url=". $url. "' > ";
}
Exit ();
}
}