Closed rud99 closed 5 years ago
@rud99 what exactly do you need about the route, only the URI? If so, you can rely on $_SERVER['REQUEST_URI']
.
If you're using FastRoute as part of a framework (like Zend Expressive) then you can use the PSR-7 request to get the URI or the matched route (as a request attribute) - the latter depends on what you're using.
lcobucci, thanks for the info! You have prompted me to a decision!
@rud99 glad to help :+1:
My code:
$dispatcher = FastRoute\simpleDispatcher(function(FastRoute\RouteCollector $r) { $r->addRoute('GET', '/part1', ['App\Controllers\HomeController', 'parts']); $r->addRoute('GET', '/part2', ['App\Controllers\HomeController', 'parts']); });
it is necessary to find out from which route the request came