//取文件的扩展名//by http://bbs.it-home.org //method 1 function get_file_ext_1($fileName){ $retval=""; $pt=strtpos($fileName,"."); if($pt){ $retval=substr($fileName,$pt 1,strlen($fileName)-$pt); } if($retval!==""){ return $retval; } return false; } //method two function get_file_ext_2($fileName){ $extend = pathinfo($fileName); $extend = strtolower($extend['extension']); if(is_string($extend)){ return $extend; } return false; } //method three function get_file_ext_3($fileName){ $extend =explode(".",$fileName); $va=count($extend)-1; $extend =$extend[$va]; if(is_string($extend)){ return $extend; } return false; } ?> 复制代码