drnk.me/utils/error.php
2023-11-29 22:40:15 +01:00

17 lines
No EOL
365 B
PHP

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