Home  »  CodeSnippets   »   How to set the JSON Header in PHP

How to set the JSON Header in PHP

Posted: February 7, 2022 | by Michael Bright

header('Content-Type: application/json');
echo json_encode($data);

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.