PHP string checking class_PHP tutorial

WBOY
Release: 2016-07-13 17:09:22
Original
756 people have browsed it

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

}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629762.htmlTechArticle* String checking 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...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template