dongqianzhan8325 2012-09-13 15:08
浏览 27
已采纳

CakePhp 2:如何在foo中获取url中的变量:bar / foo 2:bar2 / ...?

I'm using CakePhp2 and trying to get values of variables from a url.

My url looks like controller/action/foo:bar/foo2:bar2/foo3:bar3 ?

When I use $this->request['foo'] CakePhp says "Undefined index".

Any idea to find values of foo, foo2 and foo3?

  • 写回答

2条回答 默认 最新

  • doushaqing7080 2012-09-13 15:12
    关注

    check the documentation on named params. it will most likely be in

    $this->request->params['named']
    

    or even easier/cleaner for 2.x:

    $this->request->named
    

    so debug($this->request->named) for details.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?