今天给大家分享个从身份证获取生日及性别的方法
php从身份证获取出生日期方法(兼容15位与18位身份证号)
$birthdays = strtotime(strlen($pan_card)==15 ? ('19' . substr($pan_card, 6, 6)) : substr($pan_card, 6, 8));
php从身份证获取性别方法
$sex = substr($idcard, (strlen($idcard)==15 ? -2 : -1), 1) % 2 ? '1' : '0'; //1为男 2为女
发表评论 取消回复