mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[FEATURE] Optimised route matching, added optional parameters.
- Optimised route matching. This should be way more officient and also
seems to fix issues with getting the current route using the getRoute class.
- Added support for optional routes, for example: {id?}.
- Updated documentation to reflect new changes.
This commit is contained in:
@@ -224,7 +224,7 @@ class RouterBase {
|
||||
$i = 0;
|
||||
foreach($params as $param => $value) {
|
||||
$value = (isset($parameters[$param])) ? $parameters[$param] : $value;
|
||||
$url = str_ireplace('{' . $param. '}', $value, $url);
|
||||
$url = str_ireplace(array('{' . $param. '}', '{' . $param. '?}'), $value, $url);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user