dbms_primeidc/extdbms/lib/Core/Response.php
2025-04-07 17:22:59 +09:00

28 lines
560 B
PHP

<?php
namespace lib\Core;
class Response
{
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;
}
}