fix regex to support for non english letters
fix regex to support for non english letters like arabic example: // http://domain.com/dance/الرقص-العربي Route::add( '/([\d\w\._]+)/([\p{L}\d\-]+)', function($cat, $slug) { // do something });
This commit is contained in:
parent
6168bc9ab5
commit
c2cd96ab90
|
@ -58,6 +58,8 @@ class Route {
|
|||
}
|
||||
}
|
||||
|
||||
$path = urldecode($path);
|
||||
|
||||
// Get current request method
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
|
@ -81,7 +83,7 @@ class Route {
|
|||
$route['expression'] = $route['expression'].'$';
|
||||
|
||||
// Check path match
|
||||
if (preg_match('#'.$route['expression'].'#'.($case_matters ? '' : 'i'), $path, $matches)) {
|
||||
if (preg_match('#'.$route['expression'].'#'.($case_matters ? '' : 'iu'), $path, $matches)) {
|
||||
$path_match_found = true;
|
||||
|
||||
// Cast allowed method to array if it's not one already, then run through all methods
|
||||
|
|
Loading…
Reference in New Issue
Block a user