From 66a5428ec52272f5b4404bc8b22d34f92d0dffd0 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 26 May 2022 20:48:09 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=9D=E7=95=99=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E7=9A=84a=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/WebSocketDialogMsg.php | 11 +++++++++-- .../manage/components/ChatInput/index.vue | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 2a67ca38d..895058d1d 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -305,9 +305,16 @@ class WebSocketDialogMsg extends AbstractModel preg_match("/data-value=\"(.*?)\"/", $str, $matchValye); $text = str_replace($matchs[0][$key], "[:{$matchChar[1]}:{$matchId[1]}:{$matchValye[1]}:]", $text); } + // 处理链接 + preg_match_all("/]*?href=([\"'])(.*?)\\1[^>]*?>([^<]*?)<\/a>/is", $text, $matchs); + foreach ($matchs[2] as $key => $str) { + $herf = $matchs[2][$key]; + $title = $matchs[3][$key] ?: $herf; + $text = str_replace($matchs[0][$key], "{$title}", $text); + } // 过滤标签 - $text = strip_tags($text, '