aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc/json_response.php
diff options
context:
space:
mode:
Diffstat (limited to 'misc/json_response.php')
-rw-r--r--misc/json_response.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/json_response.php b/misc/json_response.php
new file mode 100644
index 0000000..4244b64
--- /dev/null
+++ b/misc/json_response.php
@@ -0,0 +1,11 @@
+<?php
+
+function json_response(
+ mixed $value,
+ string $contentType = 'application/json',
+ int $flags = 0,
+ int $depth = 512
+) {
+ header("Content-Type: $contentType");
+ echo json_encode($value, $flags, $depth);
+} \ No newline at end of file