生成十六进制累加校验码
function getcheckcode($data){ if($data){ $arr = array(); $arr = str_split($data, 2); $result = 0; for ($i=0; $i < count($arr); $i++) { $result =$result + hexdec($arr[$i]); } $result = strtoupper('0'.dechex($result)); //转换成大写 return $result; } }
最新评论