通过PHP获取MIME类型 [英] Get MIME Type via PHP

查看:214
本文介绍了通过PHP获取MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有本地访问文件,我需要获取他们的MIME类型。在WAMP / LAMP,CodeIgniter和Zend库中工作。什么是获取MIME类型信息的最好方法?

I have local access to files, which I need to get their MIME types. Working in WAMP/LAMP, CodeIgniter, and Zend libraries. What's the best way to get MIME type information?

推荐答案

没有简单的方法。您可以尝试:

http:// www .php.net / manual / en / function.finfo-file.php

There's no easy way. You could try:
http://www.php.net/manual/en/function.finfo-file.php

// return mime type ala mimetype extension
$finfo = finfo_open(FILEINFO_MIME_TYPE);

当然,这里假设您可以安装PECL扩展。

Of course, this assumes you can install PECL extensions.

这篇关于通过PHP获取MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆