1
0

Развитие бека

1. Создание БД
2. Создание бека
3. Пока создали класс юзера
This commit is contained in:
2026-01-11 17:48:05 +07:00
parent 301e179160
commit a9c146b192
9 changed files with 351 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
<?php
class RestApi {
// Получить данные из JSON запроса
public static function getInput(): array {
$json = file_get_contents('php://input');
$data = json_decode($json, true);
return $data ?? [];
}
// Отправить JSON ответ
public static function response($data, int $code = 200): void {
http_response_code($code);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data, JSON_UNESCAPED_UNICODE);
exit;
}
}
?>