Home  >  Article  >  Backend Development  >  A directory traversal function_PHP tutorial

A directory traversal function_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:09:46986browse


A directory traversal function
function dirtree($path="./test") {
echo "

";
$d = dir($path);
while (false !== ($v = $d->read())) {
if($v == "."
$v == "..")
continue;
$file = $d->path."/".$v;
echo "
$v";
if(is_dir($file))
dirtree($file );
}
$d->close();
echo "
";
}

dirtree();
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314378.htmlTechArticleA directory traversal function?php function dirtree($path="./test") { echo "dl"; $d = dir($path); while(false !== ($v = $d-read())) { if($v == "." $v == "..") continue; $file = $d-path."...
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