显示HTTP Header 信息

@param string $header
@param bool $echo

@return string
327447
public static function getHeaderInfo($header = '', $echo = true)
    {
        ob_start();
        $headers = getallheaders();
        if (!empty($header)) {
            $info = $headers[$header];
            echo($header . ':' . $info . "\n");;
        } else {
            foreach ($headers as $key => $val) {
                echo("$key:$val\n");
            }
        }
        $output = ob_get_clean();
        if ($echo) {
            echo(nl2br($output));
        } else {
            return $output;
        }
        return '';
    }
669023
public function render($echo = false)
    {
        $name = $this->field->getName();
        $display = $this->field->getDisplayName();
        $value = $this->getValue();
        $readOnly = $this->getReadOnlyString();
        $required = $this->getRequiredString();
        $type = $this->type;
        $crud = $this->field->getCRUD();

        $html = <<< HTML
        <div class="form-group">
            <label for="field-$name">$display</label> <input id="field-$name" class="form-control"  type="$type" name="$name" value="" $readOnly $required />
        </div>

         <div class="form-group">
            <label for="field-$name-confirm">Confirm $display</label> <input id="field-$name-confirm" class="form-control"  type="$type" value="" $readOnly $required />
        </div>

HTML;

        $crud->addScript(<<< HTML
<script>
    $(document).ready(function () {
        crud.addValidator(function (data) {
            if ($("#field-$name-confirm").val() != $("#field-$name").val()) {
                crud.addErrorMsg("Passwords are not matched.");
                return false;
            } else {
                return true;
            }
        });
    });
</script>
HTML
        );

        if ($echo) {
            echo $html;
        }

        return $html;
    }
790129
function renderHeader(&$header)
    {
        $name = $header->getName();
        if (!empty($name) && isset($this->_templates[$name])) {
            $this->_html .= str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
        } else {
            $this->_html .= str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
        }
    }
410102
public function hasHeader($header)
	{
		if($header instanceof HttpHeaderInterface)
		{
			return !empty($this->headers[strtolower($header->getFieldName())]);
		}
		
		return !empty($this->headers[strtolower($header)]);
	}
48906
public function header($header = null) {
			if ($this->_status != null) {
				array_push($this->_headers, $header);
				return true;
			}
			else {
				return $this->_headers;
			}
		}
75788
public function getHeader($header)
    {
        return isset($this->getHeaders()[$header]) ? $this->getHeaders()[$header] : null;
    }
651870
public function get_response_header($header = null)
    {
        if ($header) {
            return $this->response_headers[strtolower($header)];
        }
        return $this->response_headers;
    }
624686
private function getForwardedHeaderIp(string $header)
    {
        foreach (array_reverse(array_map('trim', explode(',', strtolower($header)))) as $values) {
            foreach (array_reverse(array_map('trim', explode(';', $values))) as $directive) {
                if (strpos($directive, 'for=') !== 0) {
                    continue;
                }

                $ip = trim(substr($directive, 4));

                if (self::isValid($ip) && !$this->isInProxiedIps($ip)) {
                    return $ip;
                }
            }
        }
    }
846855
private function setHeader($header)
    {
        $this->setDatetime($this->extractDatetime($header));

        $header = $this->cleanHeader($header);

        if (preg_match('/^[a-z]+.[A-Z]+:/', $header, $out)) {
            $this->setEnv($out[0]);
            $header = trim(str_replace($out[0], '', $header));
        }

        $this->header = $header;

        return $this;
    }
209103
public static function respond($response, $echo = true)
    {
        if ($response instanceof PheryResponse) {
            if (!headers_sent()) {
                if (session_id() != '') {
                    session_write_close();
                }

                header('Cache-Control: no-cache, must-revalidate', true);
                header('Expires: Sat, 26 Jul 1997 05:00:00 GMT', true);
                header('Content-Type: application/json; charset=' . (strtolower(self::$encoding)), true);
                header('Connection: close', true);
            }
        }

        if ($response) {
            $response = "{$response}";
        }

        if ($echo === true) {
            echo $response;
        }

        return $response;
    }
82197
public static function getHeader($header, $default = null)
    {
        $header  = strtolower($header);
        $headers = self::getInstance()->getHeaders();
        $headers = array_change_key_case($headers, CASE_LOWER);
        if (array_key_exists($header, $headers)) {
            $value = \is_array($headers[$header]) ? implode(', ', $headers[$header]) : $headers[$header];
            return $value;
        }
        return $default;
    }
360869
public function getHeader(string $header, string $default=''): string
  {
    return array_change_key_case( $this->headers, CASE_LOWER)[ strtolower($header) ] ?? $default;
  }
568964
public static function getHeader($header) {

		$headers = static :: getHeaders();

		if(true === isset($headers[$header])) {
			return $headers[$header];
		}

		return null;
	}
1174875
private function getHeader($name)
    {
        if (isset($this->headers[$name])) {
            return $this->headers[$name];
        }
        return false;
    }
1182
public static function fullUrl($url = '', $echo = true)
    {
        $url = Request::baseUrl() . self::url($url, false);
        if ($echo) {
            echo $url;
            return '';
        } else {
            return $url;
        }
    }
1327351
public static function encodeHeader(Header $header): string
    {
        return pack(
            'nnnnnn',
            $header->getId(),
            self::encodeFlags($header),
            $header->getQuestionCount(),
            $header->getAnswerCount(),
            $header->getNameServerCount(),
            $header->getAdditionalRecordsCount()
        );
    }
1323783
private function handleResponseHeaders($ch, $header) {
        //$this->count++;
        if (strlen($header) > 2) {
            list($key, $value) = explode(" ", rtrim($header, "\r\n"), 2);
            $key = rtrim($key, ':');
            if (!empty($this->responseHeaders[$key])) {
                if (is_array($this->responseHeaders[$key])){
                    $this->responseHeaders[$key][] = $value;
                } else {
                    $tmp = $this->responseHeaders[$key];
                    $this->responseHeaders[$key] = array();
                    $this->responseHeaders[$key][] = $tmp;
                    $this->responseHeaders[$key][] = $value;

                }
            } else {
                $this->responseHeaders[$key] = $value;
            }
        }
        return strlen($header);
    }