2017-12-24 20:00:45 +01:00
|
|
|
<?php
|
|
|
|
class Response {
|
2017-12-24 22:19:42 +01:00
|
|
|
public static function json ($data, $http_code = 200) {
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
2017-12-24 20:00:45 +01:00
|
|
|
http_response_code($http_code);
|
|
|
|
echo json_encode($data);
|
2017-12-24 22:19:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function html ($html, $http_code = 200) {
|
|
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
|
|
http_response_code($http_code);
|
|
|
|
echo $html;
|
2017-12-24 20:00:45 +01:00
|
|
|
}
|
|
|
|
}
|