While you're usually fine without it, you can and should set the Content-Type
header:
<?php
$data = [];/** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
?>
We're a place where coders share, stay up-to-date and grow their careers.
While you're usually fine without it, you can and should set the Content-Type
header:
<?php
$data = [];/** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
?>
For further actions, you may consider blocking this person and/or reporting abuse
protium -
Dragos Nedelcu -
Ram Maheshwari β‘ -
Joel Olawanle -
Discussion (0)