当前请求 HTTP_CONTENT_TYPE
@access public
@return string
177754
public function contentType()
    {
        $contentType = $this->server('CONTENT_TYPE');
        if ($contentType) {
            if (strpos($contentType, ';')) {
                list($type) = explode(';', $contentType);
            } else {
                $type = $contentType;
            }
            return trim($type);
        }
        return '';
    }
352370
public function getMediaType()
    {
        $contentType = $this->getContentType();
        if (is_string($contentType)) {
            $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType);

            return isset($contentTypeParts[0]) ? strtolower($contentTypeParts[0]) : null;
        }

        return null;
    }
457708
protected static function getRequestUrl()
    {
        $hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null);

        if(isset($hostname))
        {
            $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';

            if(!isset($_SERVER['REQUEST_URI']))
            {
                if(isset($_SERVER['QUERY_STRING']))
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
                }
                else
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'];
                }
            }
            else
            {
                return $protocol . '://' . $hostname . $_SERVER['REQUEST_URI'];
            }
        }
        else
        {
            return null;
        }
    }
834024
public function getMimeType()
	{
		$field	= $this->headers->getField( 'Content-Type' );
		$parts	= explode( ';', $field->getValue() );
		return $parts[0];
	}
22041
public function getHeaderPrototype()
    {
        if ($this->headerPrototype === NULL) {
            $this->headerPrototype = \Nette\Utils\Html::el('th')
                ->setClass(['column', 'grid-header-' . $this->getName()]);
        }

        if ($this->isSortable() && $this->getSort()) {
            $this->headerPrototype->class[] = $this->getSort() == self::ORDER_DESC
                ? 'desc'
                : 'asc';
        }

        return $this->headerPrototype;
    }
1247519
protected function getRenderType()
    {
        $headers = $this->request->getHeaders();
        
        if (isset($headers['X-Requested-With'])) {
            return 'json';
        }
        
        if ($this->input('get.ajax')) {
            return 'json';
        }
        
        $contentType = $this->request->detectContentType();
        
        if (strpos($contentType, 'json')) {
            return 'json';
        } elseif (strpos($contentType, 'xml')) {
            return 'xml';
        } elseif (strpos($contentType, 'html')) {
            return 'html';
        } elseif (strpos($contentType, 'plain')) {
            return 'text';
        }
        
        return 'html';
    }
1306820
public function get_content_type() {
		$headers = wp_remote_retrieve_headers( $this->response );
		if ( ! $headers ) {
			return;
		}

		if ( ! is_object( $headers ) || ! method_exists( $headers, 'offsetGet' ) ) {
			return;
		}

		return $headers->offsetGet( 'content-type' );
	}
985163
public static function getHeaders()
    {
        if (self::$headers === null) {
            if (function_exists('apache_request_headers')) {
                $headers = apache_request_headers();
            } else {
                $headers = array();
                if (isset($_SERVER['CONTENT_TYPE'])) {
                    $headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];
                }
                if (isset($_ENV['CONTENT_TYPE'])) {
                    $headers['Content-Type'] = $_ENV['CONTENT_TYPE'];
                }
                foreach ($_SERVER as $key => $value) {
                    if (substr($key, 0, 5) == "HTTP_") {
                        // this is chaos, basically it is just there to capitalize the first
                        // letter of every word that is not an initial HTTP and strip HTTP
                        // code from przemek
                        $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
                        $headers[$key] = $value;
                    }
                }
            }
            self::$headers = $headers;
        }

        return self::$headers;
    }
282139
@Override
    public String getContentType() {
	URLConnection connection = null;
	try {
	    connection = url.openConnection();
	}
	catch (IOException e) {}
	if (connection == null) return DEFAULT_CONTENT_TYPE;

	return connection.getContentType();

    }
516042
private String getRequestHeaderContentType() {
        String contentType = getRequestHeaderValue("Content-Type");
        if (contentType != null) {
            // remove parameter (Content-Type := type "/" subtype *[";" parameter] )
            int index = contentType.indexOf(';');
            if (index > 0)
                contentType = contentType.substring(0, index);
            contentType = contentType.trim();
        }
        return contentType;
    }
916192
protected function http() {
        // 若$this->http不是\GuzzleHttp\Client实例，则创建一个
        if (!$this->http instanceof Client) {
            $this->http = new Client(
                array_merge(
                    [ 'base_uri' => $this->url ],
                    $this->options
                )
            );
        }

        return $this->http;
    }
925508
public function getCharset()
    {
        $charset = $this->getHeaderParameter('Content-Type', 'charset');
        if ($charset === null) {
            $contentType = $this->getContentType();
            if ($contentType === 'text/plain' || $contentType === 'text/html') {
                return 'ISO-8859-1';
            }
            return null;
        }
        return trim(strtoupper($charset));
    }
505399
public function getHeaderContent()
    {
        $headerContent = '';
        $sender = $this->getSender();
        if (!empty($sender)) {
            $headerContent .= 'From: ' . $sender . PHP_EOL;
        }
        $reply = $this->getReply();
        if (!empty($reply)) {
            $headerContent .= 'Reply-to: ' . $reply . PHP_EOL;
        }
        $recipientCc = $this->getRecipientCc();
        if (!empty($recipientCc)) {
            $headerContent .= 'Cc: ' . $recipientCc . PHP_EOL;
        }
        $recipientBcc = $this->getRecipientBcc();
        if (!empty($recipientBcc)) {
            $headerContent .= 'Bcc: ' . $recipientBcc . PHP_EOL;
        }
        if (!empty($this->mailer)) {
            $headerContent .= 'X-Mailer: ' . $this->mailer . PHP_EOL;
        }
        $headerContent .= 'MIME-Version: 1.0' . PHP_EOL;
        if (!empty($this->attachmentList)) {
            $contentType = 'multipart/mixed';
        } else {
            $contentType = 'multipart/alternative';
        }
        $headerContent .= 'Content-Type: ' . $contentType . '; boundary="' . $this->boundary . '"';
        $headerContent .= PHP_EOL . PHP_EOL;
        return $headerContent;
    }
147520
public function toString()
    {
        $request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());

        $str = trim($request) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }
723387
public function getContentType()
    {
        $contentType = $this->headers->first('Content-Type');
        if (($pos = strpos($contentType, ';')) !== false) {
            $contentType = substr($contentType, 0, $pos);
        }

        return $contentType;
    }
1314226
public function getHeaders()
    {
        $headers = array();
        if (isset($_SERVER)) {
            foreach ($_SERVER as $key => $val) {
                if (substr($key, 0, 5) == 'HTTP_') {
                    // convert HTTP_CONTENT_TYPE to Content-Type, HTTP_HOST to Host, etc.
                    $name = strtolower(substr($key, 5));
                    $name = str_replace(' ', '-', ucwords(str_replace('_', ' ', $name)));
                    $headers[$name] = $val;
                }
            }
        }
        if (count($headers) > 0) {
            return $headers;
        } else {
            return null;
        }
    }
1020854
public function getContentType() {
        if (!isset($this->metadata[OSSHeaders::CONTENT_TYPE])) {
            return null;
        }
        return $this->metadata[OSSHeaders::CONTENT_TYPE];
    }