脚本处理

This commit is contained in:
2025-07-28 19:36:21 +08:00
parent 6eb6cd61be
commit 816ed1a297
2 changed files with 58 additions and 21 deletions
-21
View File
@@ -25,25 +25,4 @@ class TbCommand extends Command
}
return self::SUCCESS;
}
}
function replaceRichTextUrls($input) {
// 匹配旧域名及其引号包裹情况(包含http/https协议)
$pattern = '#(https?://server\.xyh\.hnzhwlkj\.club|["\']https?://server\.xyh\.hnzhwlkj\.club)(/[^\s"\'<>]*)?#iu';
$replacement = function ($matches) {
$originalQuote = '';
$path = $matches[2] ?? '';
// 检测是否以引号开头
if (isset($matches[0][0]) && in_array($matches[0][0], ['"', "'"])) {
$originalQuote = $matches[0][0];
}
// 构建新URL(强制使用http协议)
return $originalQuote . 'http://219.157.255.213:25326' . $path;
};
return preg_replace_callback($pattern, $replacement, $input);
}