Php simulation server implementation of autoindex effect method _ PHP Tutorial

Source: Internet
Author: User
Php simulates how the server achieves autoindex. Php simulating server autoindex effect this article mainly introduces php simulating server autoindex effect method. The example analyzes php URL operation and parameter passing skills, methods for implementing autoindex on a php simulated server

This article describes how to implement autoindex on a php simulated server. The example analyzes php URL operations and passing parameters. it has some reference value. For more information, see

This article describes how to implement autoindex on a php simulated server. Share it with you for your reference. The specific implementation method is as follows:

1. the PHP code is as follows:

The code is as follows:

// File Browser
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

">../
foreach ($it as $file){
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()?>">


2. shows the running effect:

I hope this article will help you with php programming.

This article describes how to simulate php servers to achieve autoindex results. The example analyzes php URL operations and passing parameters...

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.