Skip to content

Commit

Permalink
改进all方法
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jul 20, 2021
1 parent 2ce3a39 commit 1012fe7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/think/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,12 @@ public function param($name = '', $default = null, $filter = '')
*/
public function all($name = '', $filter = '')
{
$data = array_merge($this->param(), $this->file());
$data = array_merge($this->param(), $this->file() ?: []);

if (is_array($name)) {
$data = $this->only($name, $data, $filter);
} elseif ($name) {
$data = $data[$name] ?? null;
}

return $data;
Expand Down Expand Up @@ -1148,7 +1150,6 @@ public function file(string $name = '')
{
$files = $this->file;
if (!empty($files)) {

if (strpos($name, '.')) {
[$name, $sub] = explode('.', $name);
}
Expand Down

0 comments on commit 1012fe7

Please sign in to comment.