php从身份证获取出生日期方法(兼容15位与18位身份证号):
$birthday = strlen($card)==15 ? ('19' . substr($card, 6, 6)) : substr($card, 6, 8);
echo $birthday
php从身份证获取性别方法:
$sex = substr($card, (strlen($card)==15 ? -2 : -1), 1) % 2 ? '1' : '0';
echo $sex//1为男 0为女
(adsbygoogle = window.adsbygoogle || []).push({});
来源:https://www.02405.com/archives/1438