PHP string Check Class

Source: Internet
Author: User

*
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 ();
}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.