useful-api.org/utils/error.php
2023-11-24 10:01:17 +01:00

13 lines
No EOL
285 B
PHP

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