abstract:本文實(shí)例講述了PHP實(shí)現(xiàn)獲取文件后綴名的幾種常用方法。分享給大家供大家參考。具體如下:方法1:function get_file_type($filename){ $type = substr($filename, strrpos($filename, ".")+1); retur
本文實(shí)例講述了PHP實(shí)現(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]; }
更多關(guān)于PHP實(shí)現(xiàn)獲取文件后綴名的幾種常用方法請(qǐng)關(guān)注PHP中文網(wǎng)(m.miracleart.cn)其他文章!