Reputation: 2087
i have the following action in my zf2 controller
public function indexAction($text1,$text2) {
}
is there any way to call indexAction with $text1 & $text2 params from route
for example :
localhost/project/index/text1/sadasd/text2/asdasd
Upvotes: 0
Views: 91
Reputation: 16445
Take a look at Zend\Mvc\Controller\Plugin\Params
.
Example code would be:
$t1 = $this->params()->fromRoute('text1');
$t2 = $this->params()->fromRoute('text1');
// Edit, actually fromRoute() is the default, so you can do it just like this
$t1 = $this->params('text1', $defaultValue);
Adding them as parameters to the indexAction()
won't really do anything.
Upvotes: 1