public static function getHeader($name = '') { if (static::$_headers == null) { if (function_exists('getallheaders')) { static::$_headers = getallheaders(); } else { $headers = array(); foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_' || $name == 'CONTENT_TYPE' || $name == 'CONTENT_LENGTH') { $headers[str_replace(array(' ', 'Http'), array('-', 'HTTP'), ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } static::$_headers = $headers; } } } if ($name) { return isset(static::$_headers[$name]) ? static::$_headers[$name] : ''; } else { return static::$_headers; } }
/** * Resets headers * @return void */ public function resetDelegatesVars() { parent::resetDelegatesVars(); static::$_headersSent = false; static::$_headers = array(); static::$_cookies = array(); static::$_sessionId = ''; static::$_sessionName = 'PHPSESSID'; static::$_session = array(); }