在cakephp中添加当前网址中的参数

时间:2016-01-28 04:44:52

标签: php cakephp cakephp-2.0

如何在cakephp的当前网址中添加参数?

为例 当前网址:

http://localhost/testwebsite/posts/index/Search.brand_id:1

我想添加参数并进行链接

http://localhost/testwebsite/posts/index/Search.brand_id:1/Search.shop_id:1

3 个答案:

答案 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)

您可以创建以下网址:

{{1}}

将创建View Page

之类的链接

答案 2 :(得分:0)

您可以写如下。并获得函数的参数。

$data = $this->params['url'];

http://localhost/testwebsite/posts/index?brand_id=1&shop_id=1