Home  >  Article  >  Backend Development  >  Directory traversal function_PHP tutorial

Directory traversal function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 10:59:44859browse

​ 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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445591.htmlTechArticleThe directory traversal function in PHP is also very common, but it has an object-oriented form, so it is also Mention: (1) dir, opendir Usage: $d = dir (directory name); $handle = opendir (directory name...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn