PHP Simulation Server to achieve the AutoIndex effect of the method, phpautoindex_php tutorial

Source: Internet
Author: User

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

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.