glob() 공개 메소드

Search specified directory to find matches for specified pattern
저자: Sterling Hughes (sterling@php.net)
public glob ( string $pattern, string $dirpath, string $pattern_type = 'php' ) : array
$pattern string a string containing the pattern to search the directory for.
$dirpath string a string containing the directory path to search.
$pattern_type string a string containing the type of pattern matching functions to use (can either be 'php', 'perl' or 'shell').
리턴 array containing all of the files and directories matching the pattern or null if no matches
예제 #1
0
 function readdir($dir)
 {
     if (isset(self::$cache[$dir])) {
         return self::$cache[$dir];
     }
     return self::$cache[$dir] = File_Find::glob(".*", $dir, self::EXT);
 }
예제 #2
0
 /**
  * Get file list
  */
 function file_list()
 {
     if (!is_dir($this->directory)) {
         return false;
     }
     $items =& File_Find::glob('#([a-zA-Z0-9])\\.png#', $this->directory, 'perl');
     if (!is_array($items) or sizeof($items) <= 0) {
         return false;
     }
     $list = array();
     while (list($key, $val) = each($items)) {
         if (sizeof($list) >= $this->number - 1) {
             return $list;
         }
         $diff = (time() - filectime($this->directory . $val)) / 60;
         if ($diff > $this->time) {
             $list[] = $val;
         }
     }
     return $list;
 }