I want to take url params in controller’s action, like method params (like in CodeIgniter). I want to have routing for UNLIMITED params amount (0, 5, 10 …).
url: http://localhost/controller/action/param1/param2/..../param10...
And action will be:
function action_something($param1, $param2, .... $param10) { ... }
Is it possible? I have simple application, and I want to have one default routing for every cases..
You can achieve that by adding an “overflow” route to your bootstrap.php file:
Then I usually use this kind of class to access the various parameters:
Usage:
Then if you have a URL such as
http://example.com/controller/action/param1/value1/param2/value2.... You can call from the controllerUrlParam::get($this, 'param1')to get the value of “param1”, etc.