AltoRouter icon indicating copy to clipboard operation
AltoRouter copied to clipboard

$match['params'] always empty

Open cherokeelakes opened this issue 5 years ago • 2 comments

I believe this is just a misunderstanding on my part, rather than a bug with Altorouter, so I apologize if this is not the place for these kinds of questions.

The params from a GET route are blank, but I think I have it correct based on the examples provided.

My route:

$router->map( 'GET', '/hello?/[n:name]', 'ViewController#show', 'hello');

URL:

echo "

URL

";

I have the code for the controller commented out, right now I am just trying to dump the values of $match['params'], but it is always empty. I am sure I am just not formatting the URL portion of the route correctly, but the examples make it seem like this is correct. Thanks for any possible help.

cherokeelakes avatar Jan 08 '20 03:01 cherokeelakes

So after testing some more:..

This works:

$router->map( 'GET', '/hello/[i:id]/', 'ViewController#show', 'hello');

echo "

URL

";

But this doesn't:

$router->map( 'GET', '/hello/[n:name]/', 'ViewController#show', 'hello');

echo "

URL

";

cherokeelakes avatar Jan 08 '20 03:01 cherokeelakes

[n:name] doesn't look like a valid match type. Check the documentation for reference: https://altorouter.com/usage/mapping-routes.html

treeindev avatar Feb 17 '20 16:02 treeindev