February 23, 2014

8:28 am
In this article, we are going to discuss about How to check the request type in Cakephp. In Cakephp, we have many number of request objects. The default request object in Cakephp is "CakeRequest". By default CakeRequest is assigned to $this->request, and is available in Controller, Views and Helpers. By getting the request type, we can do the operations accordingly.

CakeRequest provide many interfaces to access the request parameters.

  1. The first is as object properties, 
  2. Second is array indexes, 
  3. Third is through $this->request->params:


// Passed arguments
$this->request->pass;
$this->request['pass'];
$this->request->params['pass'];

// named parameters
$this->request->named;
$this->request['named'];
$this->request->params['named'];

0 comments:

Post a Comment