'image/gif','jpg' => 'image/jpeg','jpeg' => 'image/jpeg','jpe' => 'image/jpeg','bmp' => 'image/bmp','png' => 'ima"/> 'image/gif','jpg' => 'image/jpeg','jpeg' => 'image/jpeg','jpe' => 'image/jpeg','bmp' => 'image/bmp','png' => 'ima">

文件的MIME-TYPE

WBOY
Freigeben: 2016-07-28 08:29:41
Original
1056 Leute haben es durchsucht

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

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

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

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

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

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

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

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

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

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

<span>if</span>(preg_match(<span>'/Content-Type:\s+(.*?)(?:;|\s)/i'</span>,<span>$contents</span>,<span>$arr</span>)){
  <span>$mimestr</span> = strtolower(trim(<span>$arr</span>[<span>1</span>]));
  <span>$outkey</span> = array_keys(<span>$mime</span>,<span>$mimestr</span>);
  <span>echo</span><span>'文件类型是:'</span>.implode(<span>','</span>,<span>$outkey</span>) ;
}<span>else</span>{
  <span>echo</span><span>'没有匹配到类型'</span>;
}</code>
Nach dem Login kopieren
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

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

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage