Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Request & Response Objects In Cakephp

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 413
    Comment on it

    Request & Response Objects

    The request object in CakePHP permits you to find out the current status of the incoming request while the response object permits you to easily make HTTP responses from your controllers.

    Request

    By default cakephp uses Request as a request object. It incorporates various features for questioning and cooperating with request information. On every request one Request is made and afterward passed by reference to the different layers of an application that utilization demand information

    Request parameters

    Below is the request parameters.

    $this->request->params['controller'];
    $this->request->param('controller');

    Both of the above will access the same value. We access all Route Elements through this interface.

    For accessing Passed arguments we will used below code.

    $this->request->pass;
    $this->request['pass'];
    $this->request->params['pass'];

    Response

    In cakephp the default response class is cake/Network/Response .It have lots of features for creating and generating HTTP responses in our application, It is also used in testing, as it will allow us to inspect headers that was sent.

    Changing Response class

     If we want to change responce class we can do this in webroot/index.php. We can replace Response in there. This will make all our controllers to use CustomResponse and not to use Cake/Network/Response.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: