生成十六進制累加校驗碼
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;
}
}

如果有什麼問題及不懂的可以于關注公衆号
回複999加我微信交流下