例子
代码如下 | 复制代码 |
public function id_verify($my_id) { $coefficient = array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2); $remainder_map = array(1,0,'X',9,8,7,6,5,4,3,2); $count = 0; for ($i=0; $i < 17; $i++) { $count += $my_id[$i] * $coefficient[$i]; } $remainder = $count % 11; if ($my_id[17] == $remainder_map[$remainder]){ echo 'true'; }else{ echo 'false'; } } |
使用方法很简单
代码如下 | 复制代码 |
$body = '44010221990101001'; id_verify($my_id) //就会有结果输出的哦 |
时间: 2024-10-29 14:00:20