How can I access a GET request in CAKEPHP ?
If I am passing a variable in the url
http://samplesite.com/page?key1=value1&key2=value2
Should I use $_GET or $this->params to get the values in controller? What is the standard in CAKEPHP ?
In CakePHP 2.0 this appears to have changed. According to the documentation you can access $this->request->query
or $this->request['url']
.
// url is /posts/index?page=1&sort=title
$this->request->query['page'];
// You can also access it via array access
$this->request['url']['page'];
http://book.cakephp.org/2.0/en/controllers/request-response.html