is an empty function isempt ($str) {$bool =false; if ($str = = ' | | $str ==null| |
Empty ($STR)) && (!is_numeric ($STR))) $bool =true;
return $bool;
}//Whether contains function contain ($STR, $a) {$bool =false;
if (!isempt ($a) &&!isempt ($str)) {$ad =strpos ($str, $a); if ($ad >0| |!
Is_bool ($ad)) $bool =true;
return $bool; }//Is Ajax function Isajax () {if (Isset ($_server[' Http_x_requested_with ')) && Strtolower
($_server[' http_x_requested_with ') = = ' XMLHttpRequest ') {return true;
}else{return false;
};
//Whether the mailbox Public function Isemail ($STR) {if (Isempt ($STR)) is return false;
Return Filter_var ($str, Filter_validate_email);
//Whether the mobile phone number public function IsMobile ($STR) {if (Isempt ($STR)) is return false;
if (!is_numeric ($str) | | | strlen ($STR)!=11) return false;
return true; //Whether there is a Chinese public function ISINCN ($str) {return Preg_match ("/[\x7f-\xff]/", $str);
//Whether the entire English a-z,0-9 public function Iszgen ($STR) {if (isempt)) is return false;
if ($this->ISINCN ($str)) {return false;
return true; //return string encoding Public function Getencode ($str) {$encode = mb_detect_encoding ($str, Array (' ASCII ', ' UTF-8 ', ' GB2312 ', ' GB
K ', ' BIG5 '));
$encode = Strtolower ($encode);
return $encode;
//Whether the number public function Isnumber ($STR) {if (Isempt ($STR)) is return false;
Return Is_numeric ($STR); }