sgm4231
方法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];
}

方法4:

function getExt1($filename)
{
   $arr = explode(\'.\',$filename);
   return array_pop($arr);;
}

方法5:

function getExt2($filename)
{
   $ext = strrchr($filename,\'.\');
   return $ext;
}

方法6:
function getExt3($filename) { $pos = strrpos($filename, \'.\'); $ext = substr($filename, $pos); return $ext; } 方法7: function getExt4($filename) { $arr = pathinfo($filename); $ext = $arr[\'extension\']; return $ext; } 方法8: function getExt5($filename) { $str = strrev($filename); return strrev(strchr($str,\'.\',true)); }

 

 

分类:

技术点:

相关文章:

  • 2021-11-30
  • 2021-10-20
  • 2021-12-10
  • 2021-11-06
  • 2021-10-20
  • 2021-11-06
  • 2021-12-15
猜你喜欢
  • 2021-08-15
  • 2021-10-20
  • 2021-12-31
  • 2021-09-07
  • 2021-12-05
  • 2021-10-20
  • 2021-11-22
相关资源
相似解决方案