ShuanghongS 5 tháng trước cách đây
mục cha
commit
ca55478ca5
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      utils/common.class.php

+ 3 - 1
utils/common.class.php

@@ -2518,8 +2518,10 @@ class common {
        
         // 检查是否包含危险关键字(不区分大小写)
         foreach ($dangerousKeywords as $keyword) {
-            if (stripos($input, $keyword) !== false) {
+            $pattern = '/\b' . preg_quote($keyword, '/') . '\b/i'; // \b 表示单词边界
+            if (preg_match($pattern, $input)) {
                 $data = false;
+                break; // 提高性能,发现一个就返回
             }
         }