Store a normalized version of the request method in the router object for external access

develop
Sven Slootweg 11 years ago
parent 03cf41519f
commit f6d92110dd

@ -79,6 +79,7 @@ class CPHPRouter extends CPHPBaseClass
if(preg_match("/{$regex}/i", $requestpath, $matches)) if(preg_match("/{$regex}/i", $requestpath, $matches))
{ {
$this->uParameters = $matches; $this->uParameters = $matches;
$this->uMethod = strtolower($_SERVER['REQUEST_METHOD']);
if(is_array($route_destination)) if(is_array($route_destination))
{ {
@ -92,7 +93,7 @@ class CPHPRouter extends CPHPBaseClass
{ {
$sMethods = (!is_array($route_destination['methods'])) ? array($route_destination['methods']) : $route_destination['methods']; $sMethods = (!is_array($route_destination['methods'])) ? array($route_destination['methods']) : $route_destination['methods'];
if(!in_array(strtolower($_SERVER['REQUEST_METHOD']), $sMethods)) if(!in_array($this->uMethod, $sMethods))
{ {
continue; continue;
} }

Loading…
Cancel
Save