diff options
Diffstat (limited to 'lib/utils.php')
| -rw-r--r-- | lib/utils.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/utils.php b/lib/utils.php new file mode 100644 index 0000000..b81ddda --- /dev/null +++ b/lib/utils.php @@ -0,0 +1,11 @@ +<?php +function json_response(int $code, string|null $message, mixed $data) +{ + header('Content-Type: application/json'); + http_response_code($code); + return json_encode([ + 'status_code' => $code, + 'message' => $message, + 'data' => $data + ], JSON_UNESCAPED_SLASHES); +}
\ No newline at end of file |
