1

Symfony 1.4で2つのパラメーターを使用してリダイレクトできないのはなぜですか?

$this->redirect('news/edit?id='.$news->getId() . '&test='.$news->getTest());

これにより、次の代わりにhttp://mysite.com/news/edit/id/3にリダイレクトされます。

http://mysite.com/news/edit/id/3/test/4

2つのパラメータでリダイレクトするにはどうすればよいですか?

4

2 に答える 2

3

Your solution should work just fine.

But check if $news->getTest() isn't empty and check if you're not having a routing that makes problems.

Alternatively you can give this a try:

$this->getRequest()->setParameter('id', $news->getId());
$this->getRequest()->setParameter('test', $news->getTest());
$this->forward('news', 'edit');
于 2012-04-25T13:19:56.610 に答える
1

リダイレクトexpecstaurl、あなたは次のようなURLヘルパーメソッドでこのURLを構築することができます

url_for2($routeName, $params = array());

ここで、paramsは連想配列です。

于 2012-04-25T17:04:25.993 に答える