forked from yejune/limepie-php
/
response.php
53 lines (36 loc) · 872 Bytes
/
response.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace limepie;
class response
{
public static function json($arr)
{
return json_encode($arr);
}
public static function jsonp($arr)
{
$callback = request\sanitize::request('callback', 'string');
$output = static::json($arr);
if ($callback)
{
header('Content-Type: text/javascript');
return $callback . '(' . $output . ');';
}
else
{
header('Content-Type: application/x-json');
return $output;
}
}
public static function header($content = '', $status = 200, $headers = [])
{
}
public static function redirect($url)
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
die();
}
public static function forward($router)
{
}
}