Permet de définir la base de l'url dans le routeur
This commit is contained in:
@@ -22,6 +22,15 @@ class Router
|
||||
$this->url = trim($url, '/');;
|
||||
}
|
||||
|
||||
public function setBasePath(string $basePath)
|
||||
{
|
||||
$pos = strpos($this->url, $basePath);
|
||||
if ($pos !== false) {
|
||||
$this->url = substr($this->url, $pos + strlen($basePath));
|
||||
}
|
||||
var_dump($this->url);
|
||||
}
|
||||
|
||||
public function get(string $path, callable $callable): self
|
||||
{
|
||||
return $this->addRoute('GET', $path, $callable);
|
||||
|
Reference in New Issue
Block a user