Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
CodeIgniter

Request and Response in CodeIgniter

Work with IncomingRequest and Response objects for modern HTTP handling in CI4.

Request and Response in CodeIgniter — a practical guide to CodeIgniter request response with clear examples you can reuse in real projects.

CodeIgniter Tutorial Series (21/74). Prefer one article? Read the complete CodeIgniter tutorial.

Short description

CI4 exposes `$this->request` and `$this->response` in controllers for reading input and controlling output/status codes.

Request & response

$email = $this->request->getPost('email');
$json  = $this->request->getJSON(true);

return $this->response
    ->setStatusCode(201)
    ->setJSON(['ok' => true]);

Leave a reply

Your email address will not be published. Required fields are marked *