<?php header('Content-Type:application/json; charset=utf-8'); /** *MIFARE Classic Tool IC M1卡(门禁卡) *#wiegand34,#用于海康门禁,10位卡号 *#wiegand26,#用于微耕门禁,8位卡号, */ function uid_hex_dec($data, $digit = 10) { $temp_a=str_split($data); if ($digit == 10) { $data = hexdec($temp_a['6'].$temp_a['7'].$temp_a['4'].$temp_a['5'].$temp_a['2'].$temp_a['3'].$temp_a['0'].$temp_a['1']); $data = sprintf('%010s',$data); } else if ($digit == 8) { $data = hexdec($temp_a['4'].$temp_a['5']).hexdec($temp_a['2'].$temp_a['3'].$temp_a['0'].$temp_a['1']); $data = sprintf('%08s',$data); } return $data; } if(isset($_REQUEST['uid'])){ $data = $_REQUEST ['uid']; }else{ $data = '000001000E08040002932DC58690631D'; } $data = array( 'code'=>200, 'UID'=>$data, '10位卡号'=>uid_hex_dec($data,10), '8位卡号'=>uid_hex_dec($data,8) ); echo json_encode($data,JSON_UNESCAPED_UNICODE); ?>
MIFARE Classic Tool IC M1卡
读到00C095A20E08040002932DC58690631D
取前8位:并倒序得到A295C0F9
UID:A295C0F9转10位卡号
#用于海康门禁
#wiegand34
A295C000(十六进制)=2727723008(十进制)
UID:A295C000转8位卡号
#用于微耕门禁
#wiegand26
95(十六进制)->149(十进制)
C000(十六进制)->49152(十进制)
->14949152