1

我想使用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;
 }
}

这会产生一个类似的 URL

/content/agb/utm_source/affiliate/utm_medium/cpa/utm_term/foo

但是我希望它看起来像:

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

我怎么能那样做?

谢谢!

4

1 回答 1

1

我自己构建 URL 并使用gotoUrlAndExit()

$this->_helper->redirector->gotoUrlAndExit('place?thing=value');
于 2013-10-30T19:07:41.220 回答