id(); } //生成随机数 public static function generateRandStr($length = 8) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=-+'; $str = ''; for ($i = 0; $i < $length; $i++) { $str .= $chars[mt_rand(0, strlen($chars) - 1)]; } return $str; } static function filterDataParams($aData, $aParams) { foreach ($aParams as $sParam) { if (isset($aData[$sParam])) { $aData[$sParam] = self::hideStr($aData[$sParam]); } } return $aData; } //字符串敏感部分中间隐藏 static function hideStr($sStr, $iStart = 5, $iEnd = 3, $sReplace = '*') { if (empty($sStr)) return $sStr; $iStrLen = mb_strlen($sStr); if ($iStrLen <= $iStart) return $sStr; $iEnd = $iEnd > 0 ? $iEnd : $iStrLen - $iStart; $sHideStr = ''; for ($i = 0; $i < $iEnd; $i++) { $sHideStr .= $sReplace; } return mb_substr($sStr, 0, $iStart) . $sHideStr . mb_substr($sStr, $iStart + $iEnd); } static function getRandNum(): int { return rand(100000,999999); } static function genUuid(): string { return Str::orderedUuid(); } static function JonsEncode(array $aData): string { return json_encode($aData, JSON_UNESCAPED_UNICODE); } static function JonsDecode(string $aData): string { return json_decode($aData, JSON_UNESCAPED_UNICODE); } static function getMd5($value,$salt = ''): string { return md5(md5($value.$salt)); } }