PHP Simulation Server to achieve the AutoIndex effect of the method, Phpautoindex
In this paper, we describe the method of PHP simulation server to realize autoindex effect. Share to everyone for your reference. The implementation method is as follows:
The 1.PHP code is as follows:
Copy the Code code as follows: <?php
File Browsing Program
error_reporting (0);
$pwd = Empty ($_get[' dir ')? './': $_get[' dir ';
$pwd = Realpath ($PWD);
if (Is_file ($pwd)) {
Highlight_file ($PWD);
Exit
}else
$it = new Filesystemiterator ($PWD);
?>
PWD of <?php Echo $pwd?>
PWD of <?php Echo $pwd?>
"... /
if ($file->isdir ()) {
$fileSize = ' _ ';
$fileName = $file->getfilename (). '/';
} elseif ($file->isfile ()) {
$fileSize = $file->getsize ();
$fileName = $file->getfilename ();
}
$date = Date (' y-m-d h:i ', $file->getctime ());
? >getrealpath ()?> "><?php echo $fileName? ><?php Echo Str_pad ($date, 60-strlen ($fileName),", Str_ pad_left)? ><?php Echo Str_pad ($fileSize, +, ', Str_pad_left)?>
<?php}?>
2. Run the effect as shown:
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/965562.html www.bkjia.com true http://www.bkjia.com/PHPjc/965562.html techarticle PHP Simulation Server to achieve the AutoIndex effect of the method, Phpautoindex The example of this article describes the PHP simulation server implementation of AutoIndex effect method. Share to everyone for your reference. Concrete implementation of the party ...