php实现获取文件mime类型的方法
(编辑:jimmy 日期: 2025/12/21 浏览:3 次 )
本文实例讲述了php获取文件mime类型的方法。分享给大家供大家参考。具体如下:
1.使用 mime_content_type 方法
string mime_content_type ( string $filename )
Returns the MIME content type for a file as determined by using information from the magic.mime file.
<";"去掉,然后重启apache。<","去掉,然后重启apache
<?php $image = exif_imagetype('1.jpg'); $mime_type = image_type_to_mime_type($image); echo $mime_type; // image/jpeg ?>Tips:如果使用文件名的后缀来判断,因为文件后缀是可以修改的,所以使用文件后缀来判断会不准确。
希望本文所述对大家的php程序设计有所帮助。
下一篇:php强制更新图片缓存的方法
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。