开发者

simple redirect() function not working in symfony 1.4

I am assuming I'm doing something blatantly wrong here, but I can't figure out what. My code is very simple:

public function executeForward(sfWebRequest $request)
{
  //redirect traffic that has landed here to either advertiser's or our own lander
  if ( rand(1, 100) > 50 )
  {
    $this->redirect( 'http://www.google.com', 404 );
  }
  else
  {
    $this->redirect( 'http://www.bing.com', 404 );
  }
}

I know the template is loading this action as I can write sloppy code in this action and it will 500 in my browser. On top of that, here is the basic route:

forward_page:
  url:   /forwar开发者_如何学运维d
  param: { module: static, action: forward }

Do any of your symfony masters have a painfully obvious answer as to why this doesn't work? I'd greatly appreciate a nudge in the right direction.


404 is an error code : http://en.wikipedia.org/wiki/HTTP_404 Try a 302 code, it's indicate a redirection. BY the way, it's the default value of this option:
http://trac.symfony-project.org/browser/branches/1.4/lib/action/sfAction.class.php


I have a similar issue. I think the problem is with $this->redirect. As far as I could understand, $this->redirect expects the first parameter to be a symfony route. It does not accept external URLs. Not sure I am correct.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜