⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 get_class.php

📁 php做的上传工具~~必须先配置好文件~用的是XML
💻 PHP
字号:
<?php
class myDIR   
{   
    
          var   $mask       =   "";   
          var   $find       =   "";   
          var   $root       =   array();   
          var   $temp       =   array();   
          var   $result     =   array();   
    
            //**   setFIND   ********************************************************************************//   
    
          function   setFIND($val)   
          {   
                  $this->find   =   $val;  //*.xml 
          }   
    
          //**   setMASK   ********************************************************************************//   
    
          function   setMASK($val="")   
          {   
                  $this->mask   =   $val; //files  
          }   
    
          //**   setROOT   ********************************************************************************//   
    
          function   setROOT($val="")   
          {   
                  $this->root[]   =   $val; //xmlfile  
          }   
    
          //********************************************************************************************//   
    
          //**   setARRAY   ********************************************************************************//   
    
          function   setARRAY($folder="",$file="",$size="",$time="")   
          {   
                  $this->result[]   =   array("folder"=>$folder,"file"=>$file,"size"=>$size,"time"=>$time);   
          }   
    
          //**   doSEARCH   ********************************************************************************//   
    
          function   doSEARCH()   
          {   
                  for($i=0;   $i<count($this->root);   $i++)   
                  {   
                          unset($this->temp);   
    
                          $handle   =   @opendir($this->root[$i]);   
                          while   ($file   =   @readdir   ($handle))   
                          {   
                                  if   (eregi("^\.{1,2}$",$file))   
                                  {   
                                          continue;   
                                  }   
                                  $this->temp[]   =   $this->root[$i]."/$file";   
                          }   
                          @closedir($handle);   
    
                          if   (count($this->temp)   >   0)   
                          {   
                                  natcasesort($this->temp);   
    
                                  foreach   ($this->temp   as   $val)   
                                  {   
                                          switch   ($this->find)   
                                          {   
                                          case   "folder":   
                                                  $this->doFOLDER($val);   
                                          break;   
                                          case   "files":   
                                                  $this->doFILES($val);   
                                          break;   
                                          case   "all":   
                                                  $this->doFILES($val);   
                                                  $this->doFOLDER($val);   
                                          break;   
                                          }   
                                  }   
                          }   
                  }   
          }   
    
          //**   doFOLDER   ********************************************************************************//   
    
          function   doFOLDER($val)   
          {   
                  if(   is_dir($val)   )   
                  {   
                          if   ($this->find   ==   "all")   
                          {   
                                  $this->root[]   =   $val;   
                          }   
                  }   
          }   
    
          //**   doFILES   ********************************************************************************//   
    
          function   doFILES($val)   
          {   
                  if(   is_file($val)   &&   $this->doMATCH($val)   )   
                  {   
                          $this->doINFO($val);   
                  }   
          }   
    
          //**   doINFO   *********************************************************************************//   
    
          function   doINFO($val)   
          {   
                  $fSIZE   =   filesize($val);   
                  $fTIME   =   filemtime($val);   
    
                  $offset   =   strrpos   ($val,   "/");   
                  $folder   =   substr   ($val,   0,   $offset);   
                  $file       =   substr   ($val,   $offset+1);   
    
                  $this->setARRAY($folder,$file,$fSIZE,$fTIME);   
          }   
    
          //**   getRESULT   ********************************************************************************//   
    
          function   doMATCH($file)   
          {   
          $mask   =   $this->mask;   
                  $mask   =   str_replace(".",   "\.",   $mask);   
                  $mask   =   str_replace("*",   "(.*)",   $mask);   
    
                  $mask_array   =   explode(',',$mask);   
                  foreach   ($mask_array   as   $valid)   
                  {   
                          if(eregi("^$valid",   $file,   $geek))   
                          {   
                                  return   true;   
                          }   
                  }   
          }   
    
          //**   getRESULT   ********************************************************************************//   
    
          function   getRESULT()   
          {   
    
                  $version   =   split   ("\.",   phpversion());   
                  if   (   $version   <   4   )   
                  {   
                          echo   "ERROR:   phpMyAdmin   does   only   works   with   PHP-Versions   4.0   or   higher.\n<br>";   
                          echo   "Your   Version   is   (".phpversion().").";   
                          exit;   
                  }   
    
                  $this->doSEARCH();   
    
          if   (   !$this->result   )   
          {   
                  echo   "ERROR:   No   Data   or   Folder   does   not   exist   (".$this->root.")";   
                  exit;   
          }   
    
                  return   $this->result;   
    
          }   
    
          //*******************************************************************************************//   
    
  } 
  ?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -