公海数据脱敏

This commit is contained in:
2025-07-25 15:31:30 +08:00
parent 494e66488a
commit e84be2be04
3 changed files with 18 additions and 57 deletions
+12
View File
@@ -118,4 +118,16 @@ class Util
return $en;
}
public static function mask($str)
{
if(empty($str)){
return '';
}
// 只对 11 位手机号进行脱敏,中间 4 位用 * 替换
if (preg_match('/^1[3-9]\d{9}$/', $str)) {
return substr($str, 0, 3) . '****' . substr($str, -4);
}
return $str;
}
}