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]);