Upgrade HTTP Responses

Documentations

변경된 사항

  • 메소드 이름이 변경되었습니다.

Upgrade Guide

  1. HTTP Responses 클래스의 메소드 이름의 가장 중요한 변경 사항은 밑줄이 있는 메소드 이름에서 camelCase로의 전환입니다. 버전 3의 set_content_type() 메소드는 setContentType() 등으로 이름이 지정됩니다.

  2. 대부분의 경우 $this->output$this->response로 변경한 다음 메소드를 변경해야 합니다. 여기에서 모든 메소드를 찾을 수 있습니다 .

Code Example

CodeIgniter Version 3.x

<?php

$this->output->set_status_header(404);

// ...

$this->output
    ->set_content_type('application/json')
    ->set_output(json_encode(array('foo' => 'bar')));

CodeIgniter Version 4.x

<?php

$this->response->setStatusCode(404);

// ...

return $this->response->setJSON(['foo' => 'bar']);