dbms_primeidc/extdbms/lib/Http/Http.php
2025-04-10 09:39:36 +09:00

29 lines
554 B
PHP

<?php
namespace lib\Http;
class HTTP
{
protected array $headers = [];
public function __construct()
{
$this->headers = foreach ($_SERVER as $name => $value) {
if (str_starts_with($name, 'HTTP_')) {
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$headers[$key] = $value;
}
}
}
public function getHeaders(): array
{
return $this->headers;
}
public function getHeader(string $key): ?string
{
return $this->headers[$key] ?? null;
}
}