当前位置:Gxlcms > PHP教程 > php模拟服务器实现autoindex效果的方法_PHP教程

php模拟服务器实现autoindex效果的方法_PHP教程

时间:2021-07-01 10:21:17 帮助过:3人阅读

php模拟服务器实现autoindex效果的方法


这篇文章主要介绍了php模拟服务器实现autoindex效果的方法,实例分析了php操作URL及传递参数的技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了php模拟服务器实现autoindex效果的方法。分享给大家供大家参考。具体实现方法如下:

1.PHP代码如下:

代码如下:

//文件浏览程序
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



">../
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. 运行效果如下图所示:

php模拟服务器实现autoindex效果的方法   帮客之家

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/966369.htmlTechArticlephp模拟服务器实现autoindex效果的方法 这篇文章主要介绍了php模拟服务器实现autoindex效果的方法,实例分析了php操作URL及传递参数的技巧,具有...

人气教程排行