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