字节序列反转

This commit is contained in:
lai
2025-01-10 16:37:08 +08:00
parent da42a95d46
commit 0ee8b25e39
2 changed files with 13 additions and 7 deletions

View File

@@ -54,11 +54,14 @@ echo '<div id="progressText">0%</div>';
for ($k = 0; $k < $userNum; $k++) {
$hlr_detail = $redis->hGetAll($hlruser[$k]);
$imsi = explode(":", $hlruser[$k])[1];
$camel = bin2hex($hlr_detail['camel']);
// 反转字节顺序
$reversedCamel = strrev($hlr_detail['camel']);
// 将反转后的字节序列转换为十六进制字符串
$hexValue = bin2hex($reversedCamel);
$nam = bin2hex($hlr_detail['nam']);
$usedFlag = bin2hex($hlr_detail['enable']);
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$camel', '$nam', '$usedFlag')";
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$hexValue', '$nam', '$usedFlag')";
mysqli_query($dbConn, $updateSql);
// 检查错误