Merge pull request #32 from pxgamer/feature/json-headers

Add JSON header setting to the api functions
This commit is contained in:
arionum
2018-10-10 17:40:30 +03:00
committed by GitHub

View File

@@ -24,6 +24,10 @@ function san_host($a)
function api_err($data)
{
global $_config;
if (!headers_sent()) {
header('Content-Type: application/json');
}
echo json_encode(["status" => "error", "data" => $data, "coin" => $_config['coin']]);
exit;
}
@@ -32,6 +36,10 @@ function api_err($data)
function api_echo($data)
{
global $_config;
if (!headers_sent()) {
header('Content-Type: application/json');
}
echo json_encode(["status" => "ok", "data" => $data, "coin" => $_config['coin']]);
exit;
}