Explorar el Código

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

huangsanjia hace 2 años
padre
commit
16142a05b6
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  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 . '`';