Home > Backend Development > PHP Tutorial > felayman-php_获取上传文件的后缀名

felayman-php_获取上传文件的后缀名

WBOY
Release: 2016-06-13 11:54:03
Original
717 people have browsed it

felayman----php_获取上传文件的后缀名

<?php /** * Created by PhpStorm. * User: FelayMan * Date: 14-4-7 * Time: 下午5:34 */    function get_file_name($str){        //将上传文件名称进行反转        $str1 = strrev($str);        //explode — 以指定符号将一个字符串分割成一个数组        $tmp_str = explode('.',$str1);        //再次将字符串进行反转        $name = strrev($tmp_str[0]);        return $name;    }    if(!empty($_POST['submit'])){       $file_name =  get_file_name($_POST['file']);       echo $file_name;    }?>    <title>获取上传文件的后缀</title>    <meta charset="utf-8">
Copy after login
选择上传文件:

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template