The directory traversal function in PHP is originally very common, but it has an "object-oriented" form, so I also mention it:
(1)dir, opendir
Usage:
$d = dir("directory name");
$handle = opendir("directory name");
The former returns a directory object, and the latter returns a directory handle. The object returned by the former has two attributes: handle and path. The first is equivalent to the handle returned by opendir, and the second is the directory name itself. Use $d- when accessing >handle and $d->path.
(2)read, readdir, rewind, rewinddir, close, closedir
The first of each of the three groups is a method of the directory object, which is called with "Object->Method()", and the latter is a function, which is called with "function name (directory handle)". read returns the next item in the directory File name. rewind is the first file name returned to the directory. close is to close the directory and no longer traverse.
(3)chdir
Convert PHP's working directory.