开发者

ZF redirector. Why redirect page doesn't get HTTP_REFERER?

开发者 https://www.devze.com 2023-03-16 16:14 出处:网络
I have two actions in controller: function indexAction() { 开发者_Go百科 $this->_redirect(\'/index/welcome/\');

I have two actions in controller:

function indexAction()
{
   开发者_Go百科 $this->_redirect('/index/welcome/');
}

function welcomeAction()
{
    echo isset($_SERVER['HTTP_REFERER']);
}

After redirect it returns always null. How to fix it?


Redirect (301,303) works on the HTTP level and not the HTML level, i.e. a browser is not aware of the redirect with the exception of the information to update the URL.


This may be:
function welcomeAction() { echo isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; }


I don't think that it's specified that a client must send the Referer, so it's very likely that your browser simply doesn't send the Referer with the redirected request. You can check that using FireBug or some other tool that allows you to inspect the request headers. The Referer header is described in RFC 2616.

0

精彩评论

暂无评论...
验证码 换一张
取 消