// Data display restoration data pattern important for content output input values can be strings or one/two-dimensional arrays // before performing this method, data_revert (), the form content does not need to be restored to form verification classes commonly used in PHP dynamic web page development.
Class class_post
{
// Verify whether it is a combination of letters and numbers with a specified length
Function fun_text1 ($ num1, $ num2, $ str)
{
Return (preg_match ('/^ [a-zA-Z0-9] {'. $ num1. ','. $ num2. '} $/', $ str ))? True: false;
}
// Verify whether it is a number of the specified length
Function fun_text2 ($ num1, $ num2, $ str)
{
Return (preg_match ('/^ [0-9] {'. $ num1. ','. $ num2. '} $/I', $ str ))? True: false;
}
// Verify whether the Chinese character is of the specified length
Function fun_font ($ num1, $ num2, $ str)
{
// Preg_match ('/^ [\ xa0-\ xff] {1, 4} $/', $ string );
Return (preg_match ('/^ ([\ x81-\ xfe] [\ x40-\ xfe]) {'. $ num1 .','. $ num2. '} $/', $ str ))? True: false;
}
// Verify the ID card number
Function fun_status ($ str)
{
Return (preg_match ('/(^ ([\ d] {15} | [\ d] {18} | [\ d] {17} x) $ )/', $ str ))? True: false;
}
// Verify the email address
Function fun_email ($ str ){
Return (preg_match ('/^ [_\. 0-9a-z-] @ ([0-9a-z] [0-9a-z-] \.) [a-z] {2, 4} $/', $ str ))? True: false;
}
// Verify the phone number
Function fun_phone ($ str)
{