configu.php
index.php
New Folder
d:\xampp\htdocs\1test\use\useversion/configu.php
d:\xampp\htdocs\1test\use\useversion/index.php
d:\xampp\htdocs\1test\use\useversion/mmmmmmmmmmm/configu2222222222222.php
d:\xampp\htdocs\1test\use\useversion/configu.php
d:\xampp\htdocs\1test\use\useversion/index.php
d:\xampp\htdocs\1test\use\useversion/mmmmmmmmmmm/configu2222222222222.php
d:\xampp\htdocs\1test\use\useversion/new Folder
Code:
<?php
function Getdir ($dirname) {
Global $num;
$DH = Opendir ($dirname);
while (($file = Readdir ($DH))!== false) {
if ($file! = '. ' && $file! = ' ... ') {
if (Is_dir ($dirname. $file. ‘/‘))
Getdir ($dirname. $file. ‘/‘);
else {echo $file. ' <br/> ';}
}}}
Getdir ("./useversion");
echo "
?>
<?php
function Myscandir ($pathname) {
foreach (Glob ($pathname) as $filename) {
if (Is_dir ($filename)) {
Myscandir ($filename. ' /*‘);
}else{
Echo ' <br> '. $filename;
}
}
}
Myscandir (' D:\xampp\htdocs\1test\use\useversion ');
echo "?>
<?php
function Myscandir2 ($path) {
$mydir =dir ($path);
while ($file = $mydir->read ()) {
$p = $path. ' /'. $file;
if ((Is_dir ($p)) and ($file! = ".") and ($file! = "...")) {
Myscandir2 ($p);
}
if ($file! = ".") and ($file! = "...")) {
Echo ' <br> '. $p;
}
}
}
Myscandir2 (' D:\xampp\htdocs\1test\use\useversion ');
echo "?>
PHP folder traversal Two kinds of comparison