欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP實現(xiàn)獲取文件后綴名的幾種常用方法

 更新時間:2015年08月08日 16:46:23   作者:aoyoo111  
這篇文章主要介紹了PHP實現(xiàn)獲取文件后綴名的幾種常用方法,通過三種不同的方法實例分析了php獲取文件后綴名的實現(xiàn)技巧,分別通過字符串、文件屬性及數(shù)組等方式實現(xiàn)這一功能,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了PHP實現(xiàn)獲取文件后綴名的幾種常用方法。分享給大家供大家參考。具體如下:

方法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程序設(shè)計有所幫助。

相關(guān)文章

最新評論