flightphp / core

An extensible micro-framework for PHP
https://docs.flightphp.com
MIT License
2.62k stars 409 forks source link

multiple words route #471

Closed oscarlosan closed 8 months ago

oscarlosan commented 2 years ago

hello, How can I allow multiple words in a route?

//domain.com/detroit //domain.com/new-york $city='detroit|miami|new-york|boston'; F::route('/('.$city.')', function(){ ... });

kuopassa commented 2 years ago

How about do this:

F::route(
'GET /@city:[a-z-]{3,30}',
function($city) {
echo $city;
}
);