mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added Uri::method() to get current HTTP method (GET/POST etc)
This commit is contained in:
parent
e4f2808870
commit
76fb11366b
|
|
@ -1,3 +1,9 @@
|
|||
# v1.5.0-rc.2
|
||||
## mm/dd/2018
|
||||
|
||||
1. [](#new)
|
||||
* Added `Uri::method()` to get current HTTP method (GET/POST etc)
|
||||
|
||||
# v1.5.0-rc.1
|
||||
## 07/31/2018
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ if (!is_file($autoload)) {
|
|||
die("Please run: <i>bin/grav install</i>");
|
||||
}
|
||||
|
||||
if (PHP_SAPI == 'cli-server') {
|
||||
if (PHP_SAPI === 'cli-server') {
|
||||
if (!isset($_SERVER['PHP_CLI_ROUTER'])) {
|
||||
die("PHP webserver requires a router to run Grav, please use: <pre>php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php</pre>");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,17 @@ class Uri
|
|||
return $this->extension;
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$method = isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET';
|
||||
|
||||
if ($method === 'POST' && isset($_SERVER['X-HTTP-METHOD-OVERRIDE'])) {
|
||||
$method = strtoupper($_SERVER['X-HTTP-METHOD-OVERRIDE']);
|
||||
}
|
||||
|
||||
return $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the scheme of the URI
|
||||
*
|
||||
|
|
@ -620,10 +631,9 @@ class Uri
|
|||
}
|
||||
|
||||
return $ip;
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Returns current Uri.
|
||||
*
|
||||
* @return \Grav\Framework\Uri\Uri
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user