|
|
|
@ -1058,7 +1058,7 @@ function preg_link($text){ |
|
|
|
return $text; |
|
|
|
} |
|
|
|
// 匹配更广泛的 URL 的正则表达式 |
|
|
|
$pattern ='/\b(?:https?:\/\/|ftp:\/\/)?([a-z0-9-+&@#\/%?=~_|!:,.;]*\.[a-z]{2,}(?:\/[a-z0-9-+&@#\/%?=~_|!:,.;]*)*)\b/i'; |
|
|
|
$pattern = '~(?:\b(?:https?|ftp)://[^\s<>]+(?::\d{1,5})?(?:/[^\s?#]*(?:\?[^\s#]*)?(?:\#[^\s]*)?)?|\bwww\.[^\s<>]+(?::\d{1,5})?(?:/[^\s?#]*(?:\?[^\s#]*)?(?:\#[^\s]*)?)?)(?!\w)~xi'; |
|
|
|
// 使用preg_replace()函数将URL转换为<a>标签 |
|
|
|
$replaced_text = preg_replace_callback($pattern, function($matches) { |
|
|
|
$url = $matches[0]; |
|
|
|
|