'image/gif', 'jpg' => 'image/jpeg', 'jpeg'">
当前位置:Gxlcms > PHP教程 > 文件的MIME-TYPE

文件的MIME-TYPE

时间:2021-07-01 10:21:17 帮助过:32人阅读

header("content-type:text/html;charset=gbk");
$mime = array(
    'gif' => 'image/gif',
    'jpg' => 'image/jpeg',
    'jpeg' => 'image/jpeg',
    'jpe' => 'image/jpeg',
    'bmp' => 'image/bmp',
    'png' => 'image/png',
    'tif' => 'image/tiff',
    'tiff' => 'image/tiff',
    'pict' => 'image/x-pict',
    'pic' => 'image/x-pict',
    'pct' => 'image/x-pict',
    'tif' => 'image/tiff',
    'tiff' => 'image/tiff',
    'psd' => 'image/x-photoshop',

    'swf' => 'application/x-shockwave-flash',
    'js' => 'application/x-javascrīpt',
    'pdf' => 'application/pdf',
    'ps' => 'application/postscrīpt',
    'eps' => 'application/postscrīpt',
    'ai' => 'application/postscrīpt',
    'wmf' => 'application/x-msmetafile',

    'css' => 'text/css',
    'htm' => 'text/html',
    'html' => 'text/html',
    'txt' => 'text/plain',
    'xml' => 'text/xml',
    'wml' => 'text/wml',
    'wbmp' => 'image/vnd.wap.wbmp',

    'mid' => 'audio/midi',
    'wav' => 'audio/wav',
    'mp3' => 'audio/mpeg',
    'mp2' => 'audio/mpeg',

    'avi' => 'video/x-msvideo',
    'mpeg' => 'video/mpeg',
    'mpg' => 'video/mpeg',
    'qt' => 'video/quicktime',
    'mov' => 'video/quicktime',

    'lha' => 'application/x-lha',
    'lzh' => 'application/x-lha',
    'z' => 'application/x-compress',
    'gtar' => 'application/x-gtar',
    'gz' => 'application/x-gzip',
    'gzip' => 'application/x-gzip',
    'tgz' => 'application/x-gzip',
    'tar' => 'application/x-tar',
    'bz2' => 'application/bzip2',
    'zip' => 'application/zip',
    'arj' => 'application/x-arj',
    'rar' => 'application/x-rar-compressed',

    'hqx' => 'application/mac-binhex40',
    'sit' => 'application/x-stuffit',
    'bin' => 'application/x-macbinary',

    'uu' => 'text/x-uuencode',
    'uue' => 'text/x-uuencode',

    'latex'=> 'application/x-latex',
    'ltx' => 'application/x-latex',
    'tcl' => 'application/x-tcl',

    'pgp' => 'application/pgp',
    'asc' => 'application/pgp',
    'exe' => 'application/x-msdownload',
    'doc' => 'application/msword',
    'rtf' => 'application/rtf',
    'xls' => 'application/vnd.ms-excel',
    'ppt' => 'application/vnd.ms-powerpoint',
    'mdb' => 'application/x-msaccess',
    'wri' => 'application/x-mswrite',
);
$url = 'http://tp4.sinaimg.cn/1692980395/180/1298526784/0';
//$url = 'http://www.baidu.com/';$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($ch);
curl_close($ch);

if(preg_match('/Content-Type:\s+(.*?)(?:;|\s)/i',$contents,$arr)){
  $mimestr = strtolower(trim($arr[1]));
  $outkey = array_keys($mime,$mimestr);
  echo'文件类型是:'.implode(',',$outkey) ;
}else{
  echo'没有匹配到类型';
}

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了 文件的MIME-TYPE,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 人气教程排行