来看一个简单的demo:

    function get_file_suffix($file_name, $allow_type = array()){

      $file_suffix = strtolower(array_pop(explode('.', $file_name)));
      if (empty($allow_type)){
        return $file_suffix;
      }else{
        if (in_array($file_suffix, $allow_type)){
        return true;
      }else{
        return false;
      }
      }
      }

 posted on 2018-11-20 17:26  龙宸轩  阅读(220)  评论(0)    收藏  举报