如何在cakephp的當前網址中添加參數?在cakephp的當前網址中添加參數
爲例 當前網址:
http://localhost/testwebsite/posts/index/Search.brand_id:1
我要添加參數,並做了鏈接
http://localhost/testwebsite/posts/index/Search.brand_id:1/Search.shop_id:1
如何在cakephp的當前網址中添加參數?在cakephp的當前網址中添加參數
爲例 當前網址:
http://localhost/testwebsite/posts/index/Search.brand_id:1
我要添加參數,並做了鏈接
http://localhost/testwebsite/posts/index/Search.brand_id:1/Search.shop_id:1
您可以編寫象下面這樣。並獲得你的功能參數。
$data = $this->params['url'];
http://localhost/testwebsite/posts/index?brand_id=1&shop_id=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
您可以創建URL,如:
echo $this->Html->link('View Page', array(
'controller' => 'page',
'action' => 'view',
'?' => array('Search.brand_id' => 1, 'Search.shop_id' => 1))
);
這將創建鏈接像View Page