mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Merge pull request #31 from skipperbent/development
[BUGFIX] Fixed support for urls like /path/{param}/path
This commit is contained in:
@@ -42,12 +42,15 @@ class RouterRoute extends RouterEntry {
|
||||
$url = parse_url($request->getUri());
|
||||
$url = $url['path'];
|
||||
|
||||
$route = $this->url;
|
||||
$route = rtrim($this->url, '/') . '/';
|
||||
|
||||
$routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route);
|
||||
|
||||
$tmp = explode('/', $route);
|
||||
$tmp2 = explode('/', $url);
|
||||
|
||||
// Check if url parameter count matches
|
||||
if(stripos($url, $routeMatch) === 0) {
|
||||
if(stripos($url, $routeMatch) === 0 || count($tmp) === count($tmp2)) {
|
||||
|
||||
$matches = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user