From df321c3ab1210619767ba2a850ec0f003f0691da Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Sat, 10 May 2025 15:50:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E7=8B=AC=E8=BF=9B=E8=A1=8C=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/template/syzoj/problem.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/web/template/syzoj/problem.php b/web/template/syzoj/problem.php index dd1a2bd..8737c3f 100644 --- a/web/template/syzoj/problem.php +++ b/web/template/syzoj/problem.php @@ -131,12 +131,21 @@ if ($pr_flag) { // 删除代码块里的html字符防止引起混乱 $s = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) { $ss = str_replace('
', '', $matches[0]); - // 大于小于号 - $ss = htmlspecialchars_decode($ss, ENT_QUOTES | ENT_HTML5); return $ss; }, $s); // 特殊转义 $s = str_replace("
", "\n", $s); + // 把
中间的html字符转成原始字符
+      $s = preg_replace_callback('/
(.*?)<\/pre>/s', function ($matches) {
+        $content = $matches[1];
+        $content = htmlspecialchars_decode($content, ENT_QUOTES);
+        $content = str_replace("<", "<", $content);
+        $content = str_replace(">", ">", $content);
+        $content = str_replace("&", "&", $content);
+        $content = str_replace(""", "\"", $content);
+        $content = str_replace("'", "'", $content);
+        return "
" . $content . "
"; + }, $s); return $s; } ?>