PHP gives a variety of functions to read and manipulate directories, directory entries, and files attributes. PHP provides a few ways to look in a directory to see what files it holds.
Function | Description |
---|---|
chdir() | Changes the directory. |
chroot() | Changes the root directory. |
closedir() | Closes a directory handle previously opened with opendir(). |
getcwd() | Gets the current working directory. |
opendir() | Returns a directory handle that can be used with readdir(), closedir(), and rewinddir(). |
readdir() | Reads the next file from a directory handle opened with opendir(). |
rewinddir() | Rewinds directory handle pointer to the beginning of the directory. |
rmdir() | Deletes a directory. It must be empty and have a written permission. |
scandir() | Returns an array of files and directories from a given path. |
unlink() | Deletes a file from a directory. |