English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP Directory Directory Functions

Provide these functions to operate any directory.

Installation

These functions can be used without installation. They are part of the PHP core.

It is necessary to use--enable-chroot-The func option must be configured in PHP to enable the chroot() function.

PHP directory constants

Version-Indicates the earliest version of PHP that supports this function.

NumberConstantDescriptionVersion
1

DIRECTORY_SEPARATOR

Command to display system separator, path separator, in Linux it is/,in Windows it is \\3
2

PATH_SEPARATOR

Using multiple paths to include

In Windows, when you include multiple paths, use ';' to separate them, and use ':' to separate them in Linux.

4

Function list

Version-Indicates the earliest version of PHP that supports this function.

NumberFunction nameFunction descriptionVersion
1chdir()Change the current directory4
2chroot()Change the root directory4.0.4
3dir()Open directory handle and return an object4
4closedir()Close directory4
5getcwd()Get the current working directory4
6opendir()Open directory handle4
7readdir()Read entries from the directory handle4
8rewinddir()Reset the directory handle created by opendir().4
9scandir()List files and directories within the specified path5

Note -For more file system functions, please seeFile system function