AltoRouter
AltoRouter copied to clipboard
$match['params'] always empty
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.
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
";
[n:name] doesn't look like a valid match type. Check the documentation for reference: https://altorouter.com/usage/mapping-routes.html