diff --git a/base.php b/base.php index 8648b55..1d6a72f 100644 --- a/base.php +++ b/base.php @@ -57,9 +57,13 @@ function apiresult($data, $code=200) { header('Content-Type: application/json'); } - if (isset($GLOBALS['http_cache_config'])) + if (isset($GLOBALS['http_cache_config']) + && gettype($data) !== 'string' + && !isset($data['error']) + && !isset($data['ok'])) content_cache__put($GLOBALS['http_cache_config']['key'], 'ondemand,'.$GLOBALS['http_cache_config']['seconds'], $data); + if (gettype($data) !== 'string') echo json_encode($data); else echo $data;