Question : Cakephp json response
Answered by : stormy-sloth-kpt3du0djzg1
$content = json_encode(['method' => __METHOD__, 'class' => get_called_class()]);
$this->response = $this->response->withStringBody($content);
$this->response = $this->response->withType('json');
// ...
return $this->response;
Source : https://stackoverflow.com/questions/42378793/how-to-output-custom-http-body-contents-with-cakephp-3-4-echoing-causes-unable/42379581#42379581 | Last Update : Mon, 03 Jan 22