11 lines
420 B
PHP
11 lines
420 B
PHP
<?php
|
|
function redirect(string $path): void {
|
|
header('Location: '.$path, true, 302); exit;
|
|
}
|
|
function json_ok($data=[]): void {
|
|
header('Content-Type: application/json'); echo json_encode(['ok'=>true,'data'=>$data]); exit;
|
|
}
|
|
function json_error(string $msg, int $code=400): void {
|
|
http_response_code($code); header('Content-Type: application/json');
|
|
echo json_encode(['ok'=>false,'error'=>$msg]); exit;
|
|
}
|