如何在cakephp的当前网址中添加参数?
为例 当前网址:
http://localhost/testwebsite/posts/index/Search.brand_id:1
我想添加参数并进行链接
http://localhost/testwebsite/posts/index/Search.brand_id:1/Search.shop_id:1
答案 0 :(得分:1)
试试这个:
$this->request->query();
示例:
// url array
array('ext' => 'json', '?' => array('foo' => 'bar')
// resulting url
/controller/action.json?foo=bar
$foo = $this->request->query('foo');
// returns "bar" in our example - or null if no foo key is found
答案 1 :(得分:1)
答案 2 :(得分:0)
您可以写如下。并获得函数的参数。
$data = $this->params['url'];
http://localhost/testwebsite/posts/index?brand_id=1&shop_id=1