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 为女
本文为原创文章,版权归国外主机测评所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ UEditor 赋值 html 数据无法按照原来样式显示怎么办?08/27
- ♥ JQuery 动态修改 onclick 函数的参数值08/27
- ♥ apache 设置网站默认首页文档的方法08/26
- ♥ PHP 判断字符串是否以指定字符(串)开头的方法11/11
- ♥ ECShop 安装过程报错:Strict Standards: Non-static method cls_image::gd_version() should not be called statically in XXX08/31
- ♥ Table 'XXX' is marked as crashed and should be repaired 的解决办法08/25
内容反馈