加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何检查文件是否是图像?

发布时间:2020-12-13 16:39:10 所属栏目:PHP教程 来源:网络整理
导读:我可以检查某个文件是否是图像?在 PHP中怎么做? 如果文件不是图像,我想给出一个警报消息. 除了 getimagesize() ,您可以使用 exif_imagetype() exif_imagetype() reads the first bytes of an image and checks its signature. When a correct signature is
我可以检查某个文件是否是图像?在 PHP中怎么做?

如果文件不是图像,我想给出一个警报消息.

除了 getimagesize(),您可以使用 exif_imagetype()

exif_imagetype() reads the first bytes of an image and checks its signature.

When a correct signature is found,the appropriate constant value will be returned otherwise the return value is FALSE. The return value is the same value that getimagesize() returns in index 2 but exif_imagetype() is much faster.

对于这两个函数,如果文件未被确定为图像,则返回FALSE.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读