소스 검색

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

huangsanjia 1 년 전
부모
커밋
16142a05b6
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  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 . '`';