CodeIgniter Forums
Response setJSON problem php tag before. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Response setJSON problem php tag before. (/showthread.php?tid=72109)



Response setJSON problem php tag before. - byazrail - 11-07-2018

Response setJSON problem.

current code;
$jsonResult = [
'status' => true
];
return $this->response->setJSON($jsonResult);

page result;
<?php{
   "success": true,

<?php added php tag problem.

response headers;
cache-control: no-store, no-cache, must-revalidate
cache-control: no-store, max-age=0, no-cache
cf-ray: 4763af155f6e9c65-AMS
content-encoding: br
content-type: application/json; charset=UTF-8
date: Wed, 07 Nov 2018 23:47:16 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Thu, 19 Nov 1981 08:52:00 GMT
last-modified: Wed, 07 Nov 2018 23:47:15 GMT
pragma: no-cache
server: cloudflare
status: 200
vary: Accept-Encoding
x-powered-by: PHP/7.1.23

response body;
<?php{
   "success": true,
   "error": false,
   "message": null,
   "results": {
       "bkeys": [],
       "ikeys": {
           "841": "1587944",
           "842": "1587690",.....


RE: Response setJSON problem php tag before. - byazrail - 11-07-2018

Problem resolved;
another loaded helper.
PHP Code:
<?php tag
php tag not closed.