php 判断文件类型的函数

1. php 判断文件类型的函数

 public  function  types($file){
        $files=array('jpg','png','JPG','PNG','gif','GIF','mp4','MP4','pdf','PDF','doc','docx','xlsx','xls');
        for ($i=0;count($files);$i++){
            if($file==$files[$i]){
                return 1; //有返回1
            }else{
                if(count($files)==$i){
                    return 0;//没有返回  0
                }
            }
        }
    }

2. 不会的可以问我哟

猜你喜欢

转载自blog.csdn.net/qq_38366657/article/details/81394764