Question : codeigniter echo set content type
Answered by :
public function jsonExit($array)
{ $this->con->output->set_content_type('application/json'); // $this->con is get_instance from the constructor $this->con->output->set_output(json_encode($array));
}
Source : https://stackoverflow.com/questions/39170041/using-exit-in-codeigniter-output-makes-the-content-type-header-to-text-html-inst | Last Update : Mon, 31 Jan 22