blob: 2101cda2cb6e9346247e4c9e8f5eeeb66cf8b33c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  | 
<?php
declare(strict_types=1);
namespace DTS\Functions;
function respondAndExit(int $responseCode, string $header, string $body = '', array $headers = []): void
{
    header($header, false, $responseCode);
    foreach ($headers as $header) {
        header($header);
    }
    echo $body;
    exit();
}
function redirectAndExit(string $location): void
{
    respondAndExit(302, 'Found', '', ["Location: $location"]);
}
  |