Use php to extract the birthday from the ID card, and use php to extract the birthday card. Use php to extract the birthday from the ID card, and use php to extract the birthday from the ID card, including 15-bit and 18-bit ID cards functiongetIDCardInfo ($ IDCard, $ format1) {$ res uses php to extract the birthday from the ID card, and php to extract the birthday card
Use php to extract a birthday from your ID card, including 15-digit and 18-digit ID cards.
Function getIDCardInfo ($ IDCard, $ format = 1) {$ result ['error'] = 0; // 0: Unknown error, 1: incorrect ID card format, 2: no error $ result ['flag'] = ''; // 0 indicates adult, 1 indicates minor $ result ['tdate'] =''; // birthday, format: 2012-11-15 if (! Preg_match ("/^ (\ d {15 }$ | ^ \ d {18 }$ | ^ \ d {17} (\ d | X | x) $ /", $ IDCard) {$ result ['error'] = 1; return $ result;} else {if (strlen ($ IDCard) = 18) {$ tyear = intval (substr ($ IDCard, 6, 4); $ tmonth = intval (substr ($ IDCard, 10, 2); $ tday = intval (substr ($ IDCard, 12, 2);} elseif (strlen ($ IDCard) = 15) {$ tyear = intval ("19 ". substr ($ IDCard, 6, 2); $ tmonth = intval (substr ($ IDCard, 8, 2); $ tday = intval (substr ($ IDCard, 10, 2 ));} if ($ tyear> date ("Y") | $ tyear <(date ("Y")-100) {$ flag = 0 ;} elseif ($ tmonth <0 | $ tmonth> 12) {$ flag = 0;} elseif ($ tday <0 | $ tday> 31) {$ flag = 0 ;} else {if ($ format) {$ tdate = $ tyear. "-". $ tmonth. "-". $ tday;} else {$ tdate = $ tmonth. "-". $ tday;} if (time ()-mktime (365, 0, $ tmonth, $ tday, $ tyear)> 18*24*60*60) {$ flag = 0 ;}else {$ flag = 1 ;}}$ result ['error'] = 2; // 0: Unknown error, 1: incorrect ID card format, 2: no error $ result ['isadresult'] = $ flag; // 0 indicates adult, 1 indicates minor $ result ['birthday'] = $ tdate; // return $ result ;}
Secret uses php to extract the birthday from the ID card, including the 15-and 18-digit ID card function getIDCardInfo ($ IDCard, $ format = 1) {$ res...