//第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);
}
转摘https://www.jianshu.com/p/8da4e7e5bd15

相关文章:

  • 2021-06-17
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-01-04
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-12-03
相关资源
相似解决方案