php 获取后缀的几种方法

时间:2014-08-11 14:47:52   收藏:0   阅读:264
1:
function get_extension($file){
  substr(strrchr($file, ‘.‘), 1);
}
2:
function get_extension($file){
  return substr($file, strrpos($file, ‘.‘)+1);
}
3:
function get_extension($file){
  return end(explode(‘.‘, $file));
}
4:
function get_extension($file){
  $info = pathinfo($file);
  return $info[‘extension‘];
}
5:
function get_extension($file){
  return pathinfo($file, PATHINFO_EXTENSION);
}

 

php 获取后缀的几种方法,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!