2012-07-13 96 views
0

下面代码不重定向:Zend框架 - 重定向没有回音之前不起作用

return $this->_helper->redirector->gotoUrl('/customer/'); 

但是这一次DOES重定向:

echo 'redirect'; 
return $this->_helper->redirector->gotoUrl('/customer/'); 

任何想法?他们都在我的本地主机上工作,但只有第二个在我客户端的机器上工作。 我可以在每次重定向调用之前添加echo'something',但不知道为什么它会以这种方式工作。

+0

听起来有点奇怪。客户端设置有什么不同吗? – RockyFord 2012-07-13 08:59:09

+0

你能更具体地说“不重定向”吗?一旦我们知道我们可能有些线索实际上失败了。 – 2012-07-13 13:57:23

回答

1

一次尝试这样的:

$this->_redirect("/customer/"); 

它肯定会工作。

0

在你的控制器,你应该使用重定向...

$this->_redirect('/customer/', array('exit' => true, 'code' => 301));

+0

为什么这会比重定向帮手更受欢迎?我的意思是重定向助手的默认值是exit = true code = 302. – RockyFord 2012-07-13 08:57:04

+0

这就是我一直在ZF重定向的方式,我从来没有遇到任何问题 – JamesHalsall 2012-07-13 11:48:26