feat(IndexController): 根据名字长度修改获取名字最后一个字符逻辑

This commit is contained in:
mkm 2024-07-19 09:46:31 +08:00
parent 3d00b5092f
commit ccad640b86

View File

@ -287,7 +287,7 @@ class IndexController extends BaseLikeController
$lastStr = mb_substr($name, -1, 1); // 获取名字的最后一个字符
$replaceStr = ''; // 初始化替换字符串
if ($strlen == 2) {
$replaceStr .= '*';
return $firstStr . $replaceStr;
} else {
for ($i = 0; $i < $strlen - 2; $i++) {
$replaceStr .= '*'; // 根据需要替换的字符数量,生成相应数量的星号