dbms_primeidc/extdbms/lib/Core/Http/Response.php
2025-04-22 08:59:50 +09:00

33 lines
646 B
PHP

<?php
namespace lib\Core\Http;
class Response extends HTTP
{
public function __construct()
{
parent::__construct();
}
public static function json($data, int $status = 200)
{
http_response_code($status);
header('Content-Type: application/json');
echo json_encode($data, JSON_UNESCAPED_UNICODE);
}
public static function view(string $html, int $status = 200)
{
http_response_code(200);
header('Content-Type: text/html');
echo $html;
}
public static function text(string $text, int $status = 200)
{
http_response_code($status);
header('Content-Type: text/plain');
echo $text;
}
}