Josn Header Php

josn header php
header('Content-Type: application/json');
echo json_encode($data);
josn header php
//I heavily use this, because I don't know, if any headers already was send, so the @ suppress the error message "headers already send in line xxx..."
@header('Content-type: application/json');
die(json_encode(['data' => $data, 'error' => $error]));

Leave a Comment