Przeglądaj źródła

Update fixed rules

Zhu Jinhui 6 lat temu
rodzic
commit
bc40324bf6
2 zmienionych plików z 10 dodań i 4 usunięć
  1. 2 2
      src/Base/Rules.php
  2. 8 2
      src/Driver/Base.php

+ 2 - 2
src/Base/Rules.php

@@ -183,7 +183,7 @@ class Rules
         }
         else
         {
-            if(!in_array($key, $this->forceValidKey))
+            if(!in_array($key, $this->forceValidKey) && in_array($key, $this->fields()))
             {
                 $this->forceValidKey[] = $key;
             }
@@ -217,7 +217,7 @@ class Rules
         }
         else
         {
-            if(!in_array($key, $this->optionValidKey))
+            if(!in_array($key, $this->optionValidKey) && in_array($key, $this->fields()))
             {
                 $this->optionValidKey[] = $key;
             }

+ 8 - 2
src/Driver/Base.php

@@ -1000,15 +1000,21 @@ class Base
         return $this->response;
     }
 
+    /**
+     * 转换字符创
+     *
+     * @param $str
+     * @return array|string
+     */
     public function iconv($str)
     {
         if (is_array($str)) {
             return array_map(function ($n) {
-                return iconv('GB2312', 'UTF-8', $n);
+                return toUtf8($n);
             }, $str);
         }
 
-        return iconv('GB2312', 'UTF-8', $str);
+        return toUtf8($str);
     }
 
     /**