diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-11-13 09:22:25 +0000 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-11-13 09:22:25 +0000 |
| commit | 40997195b7ee07cb1bda978186c1804371e1f16e (patch) | |
| tree | 17a6e4bd6eaca795cfa8d57b9aa6ea8ad7066593 /src/DTS/Functions.php | |
| parent | 35dc6c245d93560d7ac81df6323e8b22e571aa95 (diff) | |
Create site
Diffstat (limited to 'src/DTS/Functions.php')
| -rw-r--r-- | src/DTS/Functions.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/DTS/Functions.php b/src/DTS/Functions.php new file mode 100644 index 0000000..2101cda --- /dev/null +++ b/src/DTS/Functions.php @@ -0,0 +1,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"]); +} |
