drnk.me/utils/error.php

17 lines
365 B
PHP
Raw Normal View History

2023-11-29 21:17:08 +00:00
<?php
2023-11-29 21:40:15 +00:00
function redirect(string $url) {
header("Location: " . $url, true, 302);
}
2023-11-29 21:17:08 +00:00
function setStatusCode(int $status) {
header("HTTP/", true, $status);
}
function errorResponse(string $error, string $description) {
return [
"error" => $error,
"description" => $description,
"timestamp" => (new DateTime())->format("c")
];
}