开发者

CakePHP redirect based on query

I want to send users to certain pages based on a query string set in the url so for example: domain.com/posts/new?back=/posts

I take it I would set something up globally to deal with the back query string but how and where开发者_C百科 would I do this?

Thanks


Would this work:

// Only redirect if the "back" querystring parameter was passed and is not empty.
if ( ! empty($this->params['url']['back']) )
  $this->redirect($this->params['url']['back']);

Source: http://book.cakephp.org/view/963/The-Parameters-Attribute-params

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜