Browse Source

过滤正则匹配问题修复

magicblack 4 years ago
parent
commit
8f6c6f3032
1 changed files with 13 additions and 1 deletions
  1. 13 1
      application/common.php

+ 13 - 1
application/common.php

@@ -142,7 +142,19 @@ function mac_compress_html($s){
 
 function mac_build_regx($regstr,$regopt)
 {
-    return '/'.str_replace('/','\/',$regstr).'/'.$regopt;
+    return '/'.str_replace([
+        '/',
+        '$',
+        '+',
+        '-',
+        '{',
+    ],[
+        '\/',
+        '\$',
+        '\+',
+        '\-',
+        '\{',
+    ],$regstr).'/'.$regopt;
 }
 
 function mac_reg_replace($str,$rule,$value)