php-rest-service icon indicating copy to clipboard operation
php-rest-service copied to clipboard

Optional parameters in the url?

Open nikksan opened this issue 8 years ago • 1 comments

Is there any way I can declare optional parameters in the url ? -> (..) addGetRoute('products/(.*)/(.*)', function(){ $product = new Product(get_registry()); $product->getProducts(); }) (..) For this url I have to supply 2 arguments. How can I make it work without them?

nikksan avatar Jan 10 '17 08:01 nikksan

you should change it to products/([^/]*)/([^/]*), since .* matches also /.

marcj avatar Mar 06 '19 14:03 marcj