hiro
hiro

Reputation: 21

I want to array parameter with Zend router in ZF1

I want to customize url by Zend_Controller_Router.

I know the way when parameter is 1.

like this url

 /fruits?name=banana

is able to write by Zend router

/fruits/banana

$route = new Zend_Controller_Router_Route(
'fruits/:name/*',
array('controller'=>'fruits','action'=>'index')
);

I cant get banana like this.

$fruits = $this->getRequest()->getParam('name',NULL);

But I don't know the way to code Zend Router when paramters are more than 1

I want to this url

/fruits?name[]=banana&name[]=apple&name[]=grape

to following

/fruits/banana/apple/grape

and I want to get them in contoroller like this

$fruits = $this->getRequest()->getParam('name',NULL);

I hope get parameters like this array

$fruits = array(
'banana',
'apple',
'grape'
);

please let me know the way.

Upvotes: 2

Views: 65

Answers (0)

Related Questions