设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 数据 手机 公司
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php 获取目录下所有文件实现代码

发布时间:2022-09-22 09:46 所属栏目:121 来源:互联网
导读:class a{ private $img_dir; private $img_path; private $face_files = array(); private $allow_extension = array(); private function get_face_files() { $files = array(); if(is_dir($this-img_dir)) { if ($dh = opendir($this-img_dir)) { while ((
  class a{     
   private $img_dir;
          private $img_path;
          private $face_files = array();
          private $allow_extension = array();
  private function get_face_files()
          {
              $files = array();
              if(is_dir($this->img_dir))
              {
                  if ($dh = opendir($this->img_dir))
                  {
                      while (($file = readdir($dh)) !== false)
                      {
                          if($file == '.') continue;
                          if($file == '..') continue;
                          $fileinfo = explode('.', (basename($file)));
                          if(in_array($fileinfo[1], $this->allow_extension))
                          {//开源代码phpfensi.com
                              $files[] = array(
                                  'filename' => $fileinfo[0],
                                  'extension' => $fileinfo[1],
                              );
                          }
                      }
                      closedir($dh);
                  }
              }
              return $files;
          }
  }
   

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读