This commit is contained in:
joyqi
2021-11-04 16:37:29 +08:00
parent 0dcf45a152
commit dd4bf889de
4 changed files with 15 additions and 10 deletions
+11 -3
View File
@@ -165,7 +165,11 @@ class Request
$this->params = null;
}
return $value ?? $default;
if (isset($value)) {
return is_array($default) == is_array($value) ? $value : $default;
} else {
return $default;
}
}
/**
@@ -199,9 +203,13 @@ class Request
*/
public function getArray($key): array
{
$result = $this->get($key, []);
$result = $this->get($key, [], $exists);
return is_array($result) ? $result : [$result];
if (!empty($result) || !$exists) {
return $result;
}
return [$this->get($key)];
}
/**