🌐 AI搜索 & 代理 主页
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,23 @@ public function initialize(array $query = array(), array $request = array(), arr
}

/**
* Creates a new request with values from PHP's super globals.
* Creates a new request with values from PHP's super globals. Note that if the request method
* is PUT, then the php://input stream will also be processed for request values.
*
* @return Request A new request
*/
static public function createFromGlobals()
{
return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
$content = null;
$request = array();
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'PUT') {
$content = file_get_contents('php://input');
parse_str($content, $request);
}

$request = array_merge($request, $_POST);

return new static($_GET, $request, array(), $_COOKIE, $_FILES, $_SERVER, $content);
}

/**
Expand Down