php 获取图片后缀
作者:
windyboy | 来源:发表于
2017-11-28 23:00 被阅读0次
substr
strrchr
explode
pathinfo
正则
//第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 获取图片后缀
本文链接:https://www.haomeiwen.com/subject/vjjdqxtx.html
网友评论