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;
 }