Closed oscarlosan closed 3 years ago
is to solve this type of route: domain.com/activa-444605-45665dg5e5ew
parentheses of my previous path was added ->+) excuse me. a greeting.
how can i make it work with dash instead of slash? instead of: domain.com/activa-444605/45665dg5e5ew So: domain.com/activa-444605-45665dg5e5ew
work:
@id:[0-9]+/@code:[0-9]+
this does not work:
@id:[0-9]+-@code:[0-9]+
The parameter names can only be used on url segments. So your url would have to be domain.com/activa/@id/@code. If you need to use dashes, then just match the entire thing and use PHP explode
to break apart the string yourself.
thanks
with my previous router I had named autoroutes, 2 expressions and by get: $router->get ('/activa-([0-9]+)-([0-9a-z]+)', function ($id, $code) { } Note: parentheses shorten the route.
With Flightphp, I have put it with many combinations and it does not work: Flight::route ('/activa-@id:[0-9]+-@code:[0-9a-z]+)', function ($ id, $ code) { }
If anyone can help I would appreciate it. Thank you.