Lexiconga/backend/Response.php

14 lines
380 B
PHP
Raw Normal View History

2017-12-24 20:00:45 +01:00
<?php
class Response {
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);
}
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
}
}