src/Header.php
public function setContentType($type = 'html', $option = 'utf-8') {
        $type = strtolower($type);
        if ($type == 'image' || $type == 'img') {
            return $this->set('Content-Type', 'image/'.$option);
        }
        static $args = array(
            'ai'    => 'application/postscript',
            'aif'   => 'audio/x-aiff',
            'aifc'  => 'audio/x-aiff',
            'aiff'  => 'audio/x-aiff',
            'apk'   => 'application/vnd.android.package-archive',
            'atom'  => 'application/atom+xml',
            'avi'   => 'video/x-msvideo',
            'bin'   => 'application/macbinary',
            'bmp'   => 'image/bmp',
            'cpt'   => 'application/mac-compactpro',
            'css'   => 'text/css',
            'csv'   => 'text/x-comma-separated-values',
            'dcr'   => 'application/x-director',
            'dir'   => 'application/x-director',
            'doc'   => 'application/msword',
            'docx'  => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'dvi'   => 'application/x-dvi',
            'dxr'   => 'application/x-director',
            'eml'   => 'message/rfc822',
            'eps'   => 'application/postscript',
            'exe'   => 'application/octet-stream',
            'flv'   => 'video/x-flv',
            'flash' => 'application/x-shockwave-flash',
            'gif'   => 'image/gif',
            'gtar'  => 'application/x-gtar',
            'gz'    => 'application/x-gzip',
            'hqx'   => 'application/mac-binhex40',
            'htm'   => 'text/html',
            'html'  => 'text/html',
            'ipa'   => 'application/iphone',
            'jpe'   => 'image/jpeg',
            'jpeg'  => 'image/jpeg',
            'jpg'   => 'image/jpeg',
            'js'    => 'application/x-javascript',
            'json'  => 'application/json',
            'log'   => 'text/plain',
            'm3u8'  => 'application/x-mpegURL',
            'mid'   => 'audio/midi',
            'midi'  => 'audio/midi',
            'mif'   => 'application/vnd.mif',
            'mov'   => 'video/quicktime',
            'movie' => 'video/x-sgi-movie',
            'mp2'   => 'audio/mpeg',
            'mp3'   => 'audio/mpeg',
            'mp4'   => 'video/mpeg',
            'mpe'   => 'video/mpeg',
            'mpeg'  => 'video/mpeg',
            'mpg'   => 'video/mpeg',
            'mpga'  => 'audio/mpeg',
            'oda'   => 'application/oda',
            'pdf'   => 'application/pdf',
            'php'   => 'application/x-httpd-php',
            'php3'  => 'application/x-httpd-php',
            'php4'  => 'application/x-httpd-php',
            'phps'  => 'application/x-httpd-php-source',
            'phtml' => 'application/x-httpd-php',
            'plist' => 'application/xml',
            'png'   => 'image/png',
            'ppt'   => 'application/powerpoint',
            'ps'    => 'application/postscript',
            'psd'   => 'application/x-photoshop',
            'qt'    => 'video/quicktime',
            'ra'    => 'audio/x-realaudio',
            'ram'   => 'audio/x-pn-realaudio',
            'rm'    => 'audio/x-pn-realaudio',
            'rpm'   => 'audio/x-pn-realaudio-plugin',
            'rss'   => 'application/rss+xml',
            'rtf'   => 'text/rtf',
            'rtx'   => 'text/richtext',
            'rv'    => 'video/vnd.rn-realvideo',
            'shtml' => 'text/html',
            'sit'   => 'application/x-stuffit',
            'smi'   => 'application/smil',
            'smil'  => 'application/smil',
            'swf'   => 'application/x-shockwave-flash',
            'tar'   => 'application/x-tar',
            'tgz'   => 'application/x-tar',
            'text'  => 'text/plain',
            'tif'   => 'image/tiff',
            'tiff'  => 'image/tiff',
            'ts'    => 'video/MP2T',
            'txt'   => 'text/plain',
            'wav'   => 'audio/x-wav',
            'wbxml' => 'application/wbxml',
            'wmlc'  => 'application/wmlc',
            'word'  => 'application/msword',
            'xht'   => 'application/xhtml+xml',
            'xhtml' => 'application/xhtml+xml',
            'xl'    => 'application/excel',
            'xls'   => 'application/excel',
            'xlsx'  => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'xml'   => 'text/xml',
            'xsl'   => 'text/xml',
            'zip'   => 'application/x-zip'
        );
        if (!array_key_exists($type, $args)) {
            return $this->set('Content-type', $type);
        }
        $content = $args[$type];
        if (in_array($type, array('html', 'json', 'rss', 'xml'))) {
            $content .= ';charset='.$option;
        }
        return $this->set('Content-Type', $content);
    }
public function setContentType($type = 'html', $option = 'utf-8') {
        $type = strtolower($type);
        if ($type == 'image' || $type == 'img') {
            return $this->set('Content-Type', 'image/'.$option);
        }
        static $args = array(
            'ai'    => 'application/postscript',
            'aif'   => 'audio/x-aiff',
            'aifc'  => 'audio/x-aiff',
            'aiff'  => 'audio/x-aiff',
            'apk'   => 'application/vnd.android.package-archive',
            'atom'  => 'application/atom+xml',
            'avi'   => 'video/x-msvideo',
            'bin'   => 'application/macbinary',
            'bmp'   => 'image/bmp',
            'cpt'   => 'application/mac-compactpro',
            'css'   => 'text/css',
            'csv'   => 'text/x-comma-separated-values',
            'dcr'   => 'application/x-director',
            'dir'   => 'application/x-director',
            'doc'   => 'application/msword',
            'docx'  => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'dvi'   => 'application/x-dvi',
            'dxr'   => 'application/x-director',
            'eml'   => 'message/rfc822',
            'eps'   => 'application/postscript',
            'exe'   => 'application/octet-stream',
            'flv'   => 'video/x-flv',
            'flash' => 'application/x-shockwave-flash',
            'gif'   => 'image/gif',
            'gtar'  => 'application/x-gtar',
            'gz'    => 'application/x-gzip',
            'hqx'   => 'application/mac-binhex40',
            'htm'   => 'text/html',
            'html'  => 'text/html',
            'ipa'   => 'application/iphone',
            'jpe'   => 'image/jpeg',
            'jpeg'  => 'image/jpeg',
            'jpg'   => 'image/jpeg',
            'js'    => 'application/x-javascript',
            'json'  => 'application/json',
            'log'   => 'text/plain',
            'm3u8'  => 'application/x-mpegURL',
            'mid'   => 'audio/midi',
            'midi'  => 'audio/midi',
            'mif'   => 'application/vnd.mif',
            'mov'   => 'video/quicktime',
            'movie' => 'video/x-sgi-movie',
            'mp2'   => 'audio/mpeg',
            'mp3'   => 'audio/mpeg',
            'mp4'   => 'video/mpeg',
            'mpe'   => 'video/mpeg',
            'mpeg'  => 'video/mpeg',
            'mpg'   => 'video/mpeg',
            'mpga'  => 'audio/mpeg',
            'oda'   => 'application/oda',
            'pdf'   => 'application/pdf',
            'php'   => 'application/x-httpd-php',
            'php3'  => 'application/x-httpd-php',
            'php4'  => 'application/x-httpd-php',
            'phps'  => 'application/x-httpd-php-source',
            'phtml' => 'application/x-httpd-php',
            'plist' => 'application/xml',
            'png'   => 'image/png',
            'ppt'   => 'application/powerpoint',
            'ps'    => 'application/postscript',
            'psd'   => 'application/x-photoshop',
            'qt'    => 'video/quicktime',
            'ra'    => 'audio/x-realaudio',
            'ram'   => 'audio/x-pn-realaudio',
            'rm'    => 'audio/x-pn-realaudio',
            'rpm'   => 'audio/x-pn-realaudio-plugin',
            'rss'   => 'application/rss+xml',
            'rtf'   => 'text/rtf',
            'rtx'   => 'text/richtext',
            'rv'    => 'video/vnd.rn-realvideo',
            'shtml' => 'text/html',
            'sit'   => 'application/x-stuffit',
            'smi'   => 'application/smil',
            'smil'  => 'application/smil',
            'swf'   => 'application/x-shockwave-flash',
            'tar'   => 'application/x-tar',
            'tgz'   => 'application/x-tar',
            'text'  => 'text/plain',
            'tif'   => 'image/tiff',
            'tiff'  => 'image/tiff',
            'ts'    => 'video/MP2T',
            'txt'   => 'text/plain',
            'wav'   => 'audio/x-wav',
            'wbxml' => 'application/wbxml',
            'wmlc'  => 'application/wmlc',
            'word'  => 'application/msword',
            'xht'   => 'application/xhtml+xml',
            'xhtml' => 'application/xhtml+xml',
            'xl'    => 'application/excel',
            'xls'   => 'application/excel',
            'xlsx'  => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'xml'   => 'text/xml',
            'xsl'   => 'text/xml',
            'zip'   => 'application/x-zip'
        );
        if (!array_key_exists($type, $args)) {
            return $this->set('Content-type', $type);
        }
        $content = $args[$type];
        if (in_array($type, array('html', 'json', 'rss', 'xml'))) {
            $content .= ';charset='.$option;
        }
        return $this->set('Content-Type', $content);
    }
返回内容的MIME类型
@param string $type
@param string $option
@return Header