mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 20:12:14 +00:00
[FEATURE] Added support for domain regex matching.
- Also improved regex matching when using custom regular expressions.
This commit is contained in:
@@ -26,14 +26,14 @@ class RouterRoute extends RouterEntry {
|
|||||||
// Match on custom defined regular expression
|
// Match on custom defined regular expression
|
||||||
if($this->regexMatch) {
|
if($this->regexMatch) {
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
if(preg_match('/('.$this->regexMatch.')/is', $url, $parameters)) {
|
if(preg_match('/('.$this->regexMatch.')/is', request()->getHost() . $url, $parameters)) {
|
||||||
$this->parameters = (!is_array($parameters[0]) ? array($parameters[0]) : $parameters[0]);
|
$this->parameters = (!is_array($parameters[0]) ? array($parameters[0]) : $parameters[0]);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make regular expression based on route
|
// Make regular expression based on route
|
||||||
|
|
||||||
$route = rtrim($this->url, '/') . '/';
|
$route = rtrim($this->url, '/') . '/';
|
||||||
|
|
||||||
$parameterNames = array();
|
$parameterNames = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user