php获取文件扩展名
<?php /*** example usage ***/ $filename = 'filename.blah.txt' ; /*** get the path info ***/ $info = pathinfo ( $filename ); /*** show the extension ***/ echo $info [ 'extenstion' ]; //开源代码phpfensi.com ?> //第二种方法也基本相同以上,但使用字符串操作获得延长和争夺点(.)字符也。 <?php /*** example usage ***/ $filename = 'filename.blah.txt' ; echo getFileExtension( $filename ); /** * * @Get File extension from file name * * @param string $filename the name of the file * * @return string * **/ function getFileExtension( $filename ){ return substr ( $filename , strrpos ( $filename , '.' )); } ?>查看更多关于php获取文件扩展名 - php文件操作的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did27774