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