开发者

CakePHP redirect based on query

开发者 https://www.devze.com 2023-03-12 23:09 出处:网络
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 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

精彩评论

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