PHP checks the php code for parameters such as the user name and password of the registered user
/*** Author: Xuehu blog * Check Class */Class Check {/*** IsUsername function: check whether the username format * $ Argv is the username parameter to be checked * $ RegExp is the regular statement to be checked * return value: return username in the username format, not Return false */function IsUsername ($ Argv) {$ RegExp = '/^ [a-zA-Z0-9 _] {} $ /'; // It consists of uppercase and lowercase letters and numbers and can be 3-16 characters in length. return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsMail function: checks whether the email is in the correct format * return value: returns the email in the correct format, not Return false */function IsMail ($ Argv) {$ RegExp = '/^ [a-z0-9] [a-z \. 0-_] @ [a-z0-9 _-] (? :\. [A-z] {0, 3 }\. [a-z] {0, 2} | \. [a-z] {0, 3} | \. [a-z] {0, 2}) $/I '; return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsSmae function: checks whether the values of parameters are the same * return value: true if the values are the same * return true if the values are different */function IsSame ($ ArgvOne, $ ArgvTwo, $ Force = false) {return $ Force? $ ArgvOne ===$ ArgvTwo: $ ArgvOne ==$ ArgvTwo;}/*** IsQQ function: checks whether the parameter value conforms to the format of the QQ number * return value: the correct QQ number is returned, not false */function IsQQ ($ Argv) {$ RegExp = '/^ [1-9] [0-9] {5, 11} $/'; return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsMobile function: checks whether the parameter value is in the correct Chinese mobile phone number format * return value: the mobile phone number is returned for the correct mobile phone number, not false */function IsMobile ($ Argv) {$ RegExp = '/^ (?: 13 | 15 | 18) [0-9] {9} $/'; return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsTel function: checks whether the value of the parameter is a positive value. The format of the obtained Chinese phone number includes the area code. * return value: a correct phone number. return the phone number, not false */function IsTel ($ Argv) {$ RegExp = '/[0-9] {}-[0-9] {} $ /'; return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsNickname function: checks whether the parameter value is in the correct nickname format (Beta) * return value: the returned nickname format is in the correct nickname format, not false */function IsNickname ($ Argv) {$ RegExp = '/^ \ s * $ | ^ c: \ con $ | [%, \ * \ "\ s \ t \ <\> \ & \ '\ (\)] | \ xA1 \ xA1 | \ xAC \ xA3 | ^ Guest | ^ \ xD3 \ xCE \ xBF \ xCD | \ xB9 \ x43 \ xAB \ xC8/is '; // Copy From DZ return preg_match ($ RegExp, $ Argv )? $ Argv: false;}/*** IsChinese function: checks whether the parameter is Chinese. * return value: Yes: return parameter, not false */function IsChinese ($ Argv, $ Encoding = 'utf8') {$ RegExp = $ Encoding = 'utf8 '? '/^ [\ X {4e00}-\ x {9fa5}] $/U':'/^ ([\ x80-\ xFF] [\ x80-\ xFF]) $/'; Return preg_match ($ RegExp, $ Argv )? $ Argv: False ;}}