diff --git a/web/template/syzoj/problem.php b/web/template/syzoj/problem.php index 6691b1e..25f8109 100644 --- a/web/template/syzoj/problem.php +++ b/web/template/syzoj/problem.php @@ -128,15 +128,15 @@ if ($pr_flag) { strpos($s, "class=\"md") === false ) // 没找到,那就加上 $s = "" . $s . ""; - // 删除代码块里的
防止引起混乱 + // 删除代码块里的html字符防止引起混乱 $s = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) { - return str_replace('
', '', $matches[0]); + $ss = str_replace('
', '', $matches[0]); + // 大于小于号 + $ss = htmlspecialchars_decode($ss, ENT_QUOTES | ENT_HTML5); + return $ss; }, $s); // 特殊转义 $s = str_replace("
", "\n", $s); - // 大于小于号 - $s = str_replace("<", "<", $s); - $s = str_replace(">", ">", $s); return $s; } ?>