您现在的位置是:判断是否身份证号码
判断是否身份证号码
计算身份证号码最后一位,判断身份证号码是否正确
// 身份证校验码,根据国家标准GB 11643-1999 function isIdCardNumber($card_number) { if( strlen($card_number) != 18 ) { return false; } $crad_id_base = substr($card_number, 0, 17); $crad_id_verify = substr($card_number, -1); // 加权因子 $factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3); // 校验码对应值 $verify_number_list = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); $checksum = 0; for( $i = 0; $i < strlen($crad_id_base); $i++ ) { $checksum += substr($crad_id_base, $i, 1) * $factor[$i % 10]; } $mod = $checksum % 11; if( $crad_id_verify == $verify_number_list[$mod] ) { return true; } return false; }
随便看看
- 从MySQL日志中恢复数据
- Binary file (standard input) matches
- ajax后台定时获取数据
- Apache设置浏览器默认编码
- The InnoDB memory heap is disabled
- Linux修改密码提示passwd /usr/share/cracklib/pw_dict: error reading header
- Fatal error: cannot allocate memory for the buffer pool
- {"errcode":45047,"errmsg":"out of response count limit hint]"}
- rm -rf 删除后急救
- 微信支付退款结果通知解密
- PHP提取文章第一张图片
- bash: scp: command not found
- Linux中文乱码
- postfix清除指定账号的邮件队列
- PHP取图片指定点颜色及计算反色
站长简介
分类
最新文章
热门文章
- 微信支付退款结果通知解密
- 到ICANN投诉三五互联获取域名转移密码成功
- Linux修改密码提示passwd /usr/share/cracklib/pw_dict: error reading header
- {"errcode":45047,"errmsg":"out of response count limit hint]"}
- 微信html弹出点击右上角分享到朋友圈
- Apache禁用TRACE Method和添加X-frame-options响应头
- PHP将B转换为KB、MB、GB
- 构建微信公众号被动回复image图片消息xml
- mysqld_safe Number of processes running now
- CentOS使用chkconfig提示systemctl enable xxxx.service