【发布时间】:2014-01-13 14:21:28
【问题描述】:
我正在尝试将页面重定向到网站的主页,但更改了一些参数。我正在使用 Zend 1.12,所以我在控制器内部设置了一个动作 (setAction)。该操作更改会话变量并应重定向到引用页面。下面是动作的代码:
public function setAction()
{
// if supported locale, add to session
if (Zend_Validate::is($this->getRequest()->getParam('locale'), 'InArray',
array('haystack' => array('en', 'it'))))
{
$session = new Zend_Session_Namespace('ttb.l10n');
$session->locale = $this->getRequest()->getParam('locale');
}
// redirect to requesting URL
$url = $this->getRequest()->getServer('HTTP_REFERER');
$this->redirect($url);
}
这段代码没有抛出任何异常,但它没有做它应该做的事情,所以它没有重定向到正确的页面,它只显示 phpinfo() 页面,没有提供任何关于正在发生的事情的更多线索. 有人可以帮忙吗?
更新:重定向显示的文件是服务器根目录中的 index.php 文件。当我删除它时,它不再显示 phpinfo() 文件,但它显示 index.php 未找到。但我没有告诉它渲染 index.php 文件。我只是将其重定向到该网站的主页。还有其他帮助吗?
【问题讨论】: