//用php从身份证中提取生日,包括15位和18位身份证 |
02 |
function getIDCardInfo( $IDCard , $format =1){
|
03 |
$result [ 'error' ]=0; //0:未知错误,1:身份证格式错误,2:无错误 |
04 |
$result [ 'flag' ]= '' ; //0标示成年,1标示未成年 |
05 |
$result [ 'tdate' ]= '' ; //生日,格式如:2012-11-15 |
06 |
if (!preg_match( "/^(\\d{15}$|^\\d{18}$|^\\d{17}(\\d|X|x))$/" , $IDCard )){
|
07 |
$result [ 'error' ]=1; |
08 |
return $result ; |
09 |
} else {
|
10 |
if ( strlen ( $IDCard )==18) |
11 |
{
|