PHP - dir


]Podporované v PHP 4, PHP 5 

PHP -> Funkcie -> Adresárové funkcie PHP -> funkcia dir

Syntax

class dir {
dir ( string directory)
string path
resource handle
string read ( void )
void rewind ( void )
void close ( void )
}

Popis

Príkaz jazyka PHP
A pseudo-object oriented mechanism for reading a directory. The given directory is opened. Two properties are available once the directory has been opened. The handle property can be used with other directory functions such as readdir, rewinddir and closedir. The path property is set to path the directory that was opened. Three methods are available: read, rewind and close.

Príklad

<?php
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
   echo $entry."\n";
}
$d->close();

/*Príklad vráti niečo takéto:
Handle: Resource id #2
Path: /etc/php5
.
..
apache
cgi
cli
*/

?>


]