1
0
plweb/functions.php

18 lines
384 B
PHP

<?php
function return_success($msg = 'OK') {
return json_encode(['status' => 'success', 'message' => $msg]);
}
function return_error($code, $msg) {
http_response_code($code);
return json_encode(['status' => 'error', 'message' => $msg]);
}
function twig_error($twig, $code, $msg) {
http_response_code($code);
return $twig->render('error.html.twig', [ 'error' => $msg ]);
}
?>