mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 08:22:19 +00:00
@@ -98,12 +98,12 @@ class Input
|
|||||||
if (is_array($original['name'][$key]) === false) {
|
if (is_array($original['name'][$key]) === false) {
|
||||||
|
|
||||||
$file = InputFile::createFromArray([
|
$file = InputFile::createFromArray([
|
||||||
'index' => (empty($key) === true && empty($originalIndex) === false) ? $originalIndex : $key,
|
'index' => (empty($key) === true && empty($originalIndex) === false) ? $originalIndex : $key,
|
||||||
'name' => $original['name'][$key],
|
'name' => $original['name'][$key],
|
||||||
'error' => $original['error'][$key],
|
'error' => $original['error'][$key],
|
||||||
'tmp_name' => $original['tmp_name'][$key],
|
'tmp_name' => $original['tmp_name'][$key],
|
||||||
'type' => $original['type'][$key],
|
'type' => $original['type'][$key],
|
||||||
'size' => $original['size'][$key],
|
'size' => $original['size'][$key],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (isset($output[$key]) === true) {
|
if (isset($output[$key]) === true) {
|
||||||
@@ -254,21 +254,21 @@ class Input
|
|||||||
*/
|
*/
|
||||||
public function all(array $filter = null)
|
public function all(array $filter = null)
|
||||||
{
|
{
|
||||||
$output = $_POST;
|
$output = $_GET;
|
||||||
|
|
||||||
if ($this->request->getMethod() === 'post') {
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
$contents = file_get_contents('php://input');
|
$contents = file_get_contents('php://input');
|
||||||
|
|
||||||
if (strpos(trim($contents), '{') === 0) {
|
if (strpos(trim($contents), '{') === 0) {
|
||||||
$output = json_decode($contents, true);
|
$post = json_decode($contents, true);
|
||||||
if ($output === false) {
|
if ($post !== false) {
|
||||||
$output = [];
|
$output = array_merge($output, $post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($filter !== null) ? array_intersect_key($output, array_flip($filter)) : array_merge($_GET, $output);
|
return ($filter !== null) ? array_intersect_key($output, array_flip($filter)) : $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user