dever 7 年之前
父節點
當前提交
3a4d615536
共有 1 個文件被更改,包括 13 次插入10 次删除
  1. 13 10
      src/Api.php

+ 13 - 10
src/Api.php

@@ -67,18 +67,21 @@ class Api
      */
      */
     public function string($area)
     public function string($area)
     {
     {
-        $area = explode(',', $area);
-        $result = array();
-        foreach ($area as $k => $v) {
-            if ($k == 0) {
-                $result[$k] = $this->getName('province', $v);
-            } elseif ($k == 1) {
-                $result[$k] = $this->getName('city', $v);
-            } elseif ($k == 2) {
-                $result[$k] = $this->getName('county', $v);
+        if ($area) {
+            $area = explode(',', $area);
+            $result = array();
+            foreach ($area as $k => $v) {
+                if ($k == 0) {
+                    $result[$k] = $this->getName('province', $v);
+                } elseif ($k == 1) {
+                    $result[$k] = $this->getName('city', $v);
+                } elseif ($k == 2) {
+                    $result[$k] = $this->getName('county', $v);
+                }
             }
             }
+            return implode(',', $result);
         }
         }
-        return implode(',', $result);
+        return '';
     }
     }