作者 李宇航

合并分支 'lyh-server' 到 'master'

变更数据



查看合并请求 !3041
... ... @@ -1603,11 +1603,23 @@ if (!function_exists('httpGetSsl')) {
}
// 先取前 $limit 个字符
$truncated = mb_substr($text, 0, $limit, 'UTF-8');
// 优先找空格
$lastSpace = mb_strrpos($truncated, ' ', 0, 'UTF-8');
if ($lastSpace !== false) {
// 在最后一个空格处截断,避免英文单词被截断
if ($lastSpace === false) {
// 如果没有空格,尝试找中横线或下划线(如英文连接符)
$lastDash = max(
(mb_strrpos($truncated, '-', 0, 'UTF-8') ?: 0),
(mb_strrpos($truncated, '_', 0, 'UTF-8') ?: 0))
;
if ($lastDash > 0) {
$lastSpace = $lastDash;
}
}
// 若找到合适位置则截断
if ($lastSpace !== false && $lastSpace > 0) {
$truncated = mb_substr($truncated, 0, $lastSpace, 'UTF-8');
}
return $truncated;
}
}
... ...
... ... @@ -85,7 +85,6 @@ class RouteMap extends Base
$length = strlen($sign);
if($length > $route_len){
$sign = truncate_text($sign,$route_len);
$sign = trim($sign,'-');
}
$i=1;//路由重复时拼接
$route = $sign.$suffix;
... ...