Browse Source

优化不支持中文字段的查询

huangsanjia 1 year ago
parent
commit
16142a05b6
1 changed files with 5 additions and 1 deletions
  1. 5 1
      thinkphp/library/think/db/builder/Mysql.php

+ 5 - 1
thinkphp/library/think/db/builder/Mysql.php

@@ -109,8 +109,12 @@ class Mysql extends Builder
             }
         }
 
-        if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
+//        if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
+//            throw new Exception('not support data:' . $key);
+//        }
+        if ($strict && !preg_match('/^[\w\.\*\x00-\xff]+$/', $key)) {
             throw new Exception('not support data:' . $key);
+
         }
         if ('*' != $key && ($strict || !preg_match('/[,\'\"\*\(\)`.\s]/', $key))) {
             $key = '`' . $key . '`';