fix: ignore trailing / at the end of uri
This commit is contained in:
parent
1034dd30f9
commit
c110825140
@ -20,8 +20,9 @@ class Router
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $pathname)
|
public function __construct(string $pathname)
|
||||||
{
|
{
|
||||||
$this->uri = is_countable($_SERVER['REQUEST_URI']) && count($_SERVER['REQUEST_URI']) > 1 ? rtrim($_SERVER['REQUEST_URI'], "/") : $_SERVER['REQUEST_URI'];
|
$this->uri = str_replace($pathname, "", $_SERVER['REQUEST_URI']);
|
||||||
$this->uri = str_replace($pathname, "", $this->uri);
|
$this->uri = strlen($this->uri) > 1 ? rtrim($this->uri, "/") : $this->uri;
|
||||||
|
|
||||||
$this->requestType = $_SERVER['REQUEST_METHOD'];
|
$this->requestType = $_SERVER['REQUEST_METHOD'];
|
||||||
$this->routes = [];
|
$this->routes = [];
|
||||||
$this->middleware = [];
|
$this->middleware = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user