Skip to content

Commit

Permalink
修正命令行模式下的默认request
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Jul 15, 2022
1 parent 126d5b2 commit 88ad731
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/think/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,17 @@ protected function initialize()
*/
protected function makeRequest()
{
$uri = $this->app->config->get('app.url', 'http://localhost');
$url = $this->app->config->get('app.url', 'http://localhost');

$components = parse_url($uri);
$components = parse_url($url);

$server = $_SERVER;

if (isset($components['path'])) {
$server = array_merge($server, [
'SCRIPT_FILENAME' => $components['path'],
'SCRIPT_NAME' => $components['path'],
'REQUEST_URI' => $components['path'],
]);
}

Expand All @@ -150,8 +151,6 @@ protected function makeRequest()
$server['HTTP_HOST'] .= ':' . $components['port'];
}

$server['REQUEST_URI'] = $uri;

/** @var Request $request */
$request = $this->app->make('request');

Expand Down

0 comments on commit 88ad731

Please sign in to comment.