Pre-defined constants:
Directory_separator (String): Directory delimiter
Path_separator (String): Path delimiter
BOOL ChDir (String $directory)-Change Directory
Copy the Code code as follows:
Echo GETCWD (). "\ n";
ChDir (' public_html ');
Echo GETCWD (). "\ n";
BOOL Chroot (String $directory)-Changes the root directory only if the system supports it and is running in cli,cgi or embedded SAPI version.
Dir::d ir (string $directory)-directory class, there are three methods available: Read,rewind (the position pointer inside the file is pointed back to the beginning of a data stream) and close
Copy the Code code as follows:
$d = Dir ("e:/work/html");
foreach ($d as $k = = $v) {
echo $k. ' $v. '
';
}
while (false!== ($entry = $d->read ())) {
echo $entry. "
";
}
$d->close ();
void Closedir (Resource $dir _handle)-Close the directory handle
Copy the Code code as follows:
$dir = "/etc/php5/";
if (Is_dir ($dir)) {
if ($dh = Opendir ($dir)) {
$directory = Readdir ($DH);
Closedir ($DH);
}
}
String getcwd (void)-Gets the current working directory
Resource Opendir (String $path [, Resource $context])-Open Directory handle
String Readdir (Resource $dir _handle)-Reads an entry from the directory handle
Copy the Code code as follows:
if ($handle = Opendir ('/path/to/files ')) {
echo "Directory handle: $handle \ n";
echo "files:\n";
while (false!== ($file = Readdir ($handle))) {
echo "$file \ n";
}
Closedir ($handle);
}
void Rewinddir (Resource $dir _handle)-Resets the Dir_handle specified directory stream to the beginning of the directory
Array Scandir (string $directory [, int $sorting _order [, Resource $context]]-Lists the files and directories in the specified path
Copy the Code code as follows:
$dir = '/tmp ';
$files 1 = scandir ($dir);
$files 2 = Scandir ($dir, 1);
Print_r ($files 1);
Print_r ($files 2);
http://www.bkjia.com/PHPjc/326745.html www.bkjia.com true http://www.bkjia.com/PHPjc/326745.html techarticle Predefined constants: Directory_separator (String): Directory delimiter Path_separator (string): Path delimiter bool ChDir (string $directory)-Change Directory Replication code The code is as follows ...