字符串查找
利用strrchr函数
$extension = substr(strrchr($file,'.'),1);
利用strrpos函数
$extension = substr($file,strrpos($file,'.')+1);
利用explode分割字符串
$arr = explode('.',$file);
$extension = $arr[count($arr)-1];
利用strrev反转字符串结合分割函数
$arr explode('.',strrev($file));
$extension = strrev($arr[0]);
使用pathinfo函数
$info = pathinfo($file);
$extension = $info['extension'];