Skip to content

Instantly share code, notes, and snippets.

View nivekalara237's full-sized avatar
😉
Working from home

Kevin Lactio Kemta nivekalara237

😉
Working from home
View GitHub Profile
@nivekalara237
nivekalara237 / simple-json-reponse.php
Created August 19, 2019 15:02 — forked from james2doyle/simple-json-reponse.php
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($message = null, $code = 200)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");