Route
Table of Contents
Do something if URL path matched with pattern.
Patterns
Pattern | Description |
---|---|
:key | Matched with any but / |
? | Matched with any but / |
* | Matched with any includes / |
{\d+} | Matched with any value that pass to the regex pattern (\d+ in this case) |
Route::set('test/:foo/:bar/:baz/*', function($foo, $bar, $baz, $qux) {
test($foo, $bar, $baz, $qux);
exit;
});
Note: You can’t match page offset to the route path, so, this won’t work:
Route::set('blog/2014/:i', function($i) { if ($i > 4) { … } });
This will work:
Route::set('blog/2014', function() use($url) { if ($url['i'] > 4) { … } });