f22c5ebbfe
- PHP/MySQL Backend (XAMPP + Produktionsserver) - Front-Controller, API-Endpunkte, Session-Management - Flussmanagement-Simulation (Echtzeit, Punkt-basierter Fluss) - Stadt & Raumplanung (Prototyp, Top-Down Kachelsystem) - Klimawaechter 3D: Deiche kleiner, Baeume kippen, Budget angepasst - persistence.ts: Dualer Speicher (localStorage + Server-API) - 6 Unit-Test-Dateien fuer bestehende Simulationen Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
558 B
PHP
22 lines
558 B
PHP
<?php
|
|
/**
|
|
* GeoGraSim — JSON Response Helpers
|
|
*/
|
|
|
|
class Response {
|
|
public static function json($data, int $status = 200): void {
|
|
http_response_code($status);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
exit;
|
|
}
|
|
|
|
public static function error(string $message, int $status = 400): void {
|
|
self::json(['error' => $message], $status);
|
|
}
|
|
|
|
public static function ok($data = null): void {
|
|
self::json($data ?? ['ok' => true]);
|
|
}
|
|
}
|