1: <?php
2:
3: namespace ngatngay;
4:
5: use ngatngay\http\response;
6:
7: function response(mixed $data = null, int $status = 200, array $headers = []): response
8: {
9: return new response($data, $status, $headers);
10: }
11:
12: function redirect(string $url, int $status = 301): void
13: {
14: @ob_end_clean();
15: http_response_code($status);
16: header('Location: ' . $url);
17: exit;
18: }
19:
20: function refresh(): void
21: {
22: ob_end_clean();
23: header('Refresh:0');
24: exit;
25: }
26: