暖和的春天,万物复苏,运河水像刚刚清醒的小姑娘,浑身布满了活力,唱着新歌,向前奔去。
本文实例讲述了PHP实现获取文件后缀名的几种常用方法。分享给大家供大家参考。具体如下:
方法1:
function get_file_type($filename){
$type = substr($filename, strrpos($filename, ".")+1);
return $type;
}
方法2:
function get_file_type($filename)
{
$type = pathinfo($filename);
$type = strtolower($type["extension"]);
return $type;
}
方法3:
function get_file_type($filename)
{
$type =explode("." , $filename);
$count=count($type)-1;
return $type[$count];
}
希望本文所述对大家的php程序设计有所帮助。
以上就是PHP实现获取文件后缀名的几种常用方法。人闭上眼睛,是为了和自己相见。更多关于PHP实现获取文件后缀名的几种常用方法请关注haodaima.com其它相关文章!




