相关关键词
关于我们
最新文章
php实现不通过扩展名准确判断文件类型的方法【finfo_file方法与二进制流】
本文实例讲述了php实现不通过扩展名准确判断文件类型的方法。分享给大家供大家参考,具体如下:
第一种方法
通过php的finfo_file()
$handle=finfo_open(FILEINFO_MIME_TYPE);//This function opens a magic database and returns its resource. $fileInfo=finfo_file($handle,'./test.txt');// Return information about a file finfo_close($handle); print_r($fileInfo); echo '==========="\n"';