带有查询字符串的Zend重定向器

时间:2013-10-30 18:51:41

标签: zend-framework

我想使用Zend 1.12中的查询字符串创建重定向。可选参数应采用查询字符串的形式。

这是我的代码:

if ($this->_request->getParam('partner')){

   $controller = $this->getRequest()->getControllerName();
   $action = $this->getRequest()->getActionName();
   $module = $this->getRequest()->getModuleName();
   $params = array(
     "utm_source" => "affiliate",
     "utm_medium" => "cpa",
     "utm_term" => $this->_request->getParam('partner'),
     "utm_campaign" => "partners",
     "url" => $this->_request->getParam('url')
   );¬

   $this->_helper->redirector($action, $controller, $module, $params);
   return false;
 }
}

这会产生类似

的网址
/content/agb/utm_source/affiliate/utm_medium/cpa/utm_term/foo

但我希望这看起来像:

/content/agb?utm_source=affiliate&utm_medium=cpa&utm_term=foo

我怎么能这样做?

谢谢!

1 个答案:

答案 0 :(得分:1)

我自己构建网址并使用gotoUrlAndExit()

取得了更好的成功
$this->_helper->redirector->gotoUrlAndExit('place?thing=value');