Skip to content

Instantly share code, notes, and snippets.

@sators
Created April 24, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sators/fbd563bd6976f93e32fe to your computer and use it in GitHub Desktop.
Save sators/fbd563bd6976f93e32fe to your computer and use it in GitHub Desktop.
Output JSON from PHP with proper Content -ype Header
<?PHP
$data = /** whatever you're serializing **/;
header('Content-Type: application/json');
echo json_encode($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment