join(''); $joined = strtolower($joined); $joined = preg_replace('/[^a-z0-9]/', '', $joined) ?? ''; return $joined !== '' ? $joined : 'v'; } /** * 由「缩写基底」生成密码:首字母大写、中间小写、末字母大写、末尾 @。 * 例:zjgkjg → ZjgkjG@ */ public static function passwordFromAcronym(string $acronymLower): string { $slug = strtolower(preg_replace('/[^a-z0-9]/', '', $acronymLower) ?? ''); if ($slug === '') { return 'Xx@'; } $len = strlen($slug); if ($len === 1) { return strtoupper($slug[0]).'@'; } $first = strtoupper($slug[0]); $last = strtoupper($slug[$len - 1]); $middle = strtolower(substr($slug, 1, $len - 2)); return $first.$middle.$last.'@'; } }