【php从身份证获取性别和出生日期】php从身份证获取性别和出生年月

时间:2021-06-16  来源:生日祝福  阅读:
 代码如下

//通过身份证号查询出性别与生日

 $birth=strlen($idcard)==15 ? (ཏ'.substr($idcard, 6, 6)) :substr($idcard, 6, 8);

 $sex=substr($idcard, (strlen($idcard)==15 ? -2 : -1), 1) % 2 ?Ƈ':Ɔ'//1为男 2为女

 代码如下

//通过身份证号查询出性别与生日

 if($data['cardtype'] =='idcard'){

 $data['birth'] =strlen($data['cardno'])==15 ? (ཏ'.substr($data['cardno'], 6, 6)) :substr($data['cardno'], 6, 8);

 $data['sex'] =substr($data['cardno'], (strlen($data['cardno'])==15 ? -2 : -1), 1) % 2 ?Ƈ':Ɔ'

 

【php从身份证获取性别和出生日期】php从身份证获取性别和出生年月

http://m.bbyears.com/zhufuduanxin/124119.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新