17 lines
362 B
PHP
17 lines
362 B
PHP
<?php
|
|
|
|
namespace Api\Core;
|
|
|
|
class Response {
|
|
public static function json($data, $status = 200) {
|
|
header('Content-Type: application/json');
|
|
http_response_code($status);
|
|
echo json_encode($data);
|
|
exit;
|
|
}
|
|
|
|
public static function error($message, $status = 400) {
|
|
self::json(['error' => $message], $status);
|
|
}
|
|
}
|