php Xampp 本地主机/仪表板

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48125093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:37:04  来源:igfitidea点击:

Xampp localhost/dashboard

phpxampplocalhostdashboard

提问by Alberto

I downloaded the recent version of xampp and I installed it and everything but when i type "localhost" in the browser it redirects me to localhost/dashboard is there a way to type localhost and see the directories and files like before?

我下载了最新版本的 xampp 并安装了它和所有东西,但是当我在浏览器中键入“localhost”时,它会将我重定向到 localhost/dashboard 有没有办法像以前一样键入 localhost 并查看目录和文件?

there was some versions of xampp where you just have to change the name of the index.php or delete it and you could see the directories and files in localhost from the browser

在某些版本的 xampp 中,您只需更改 index.php 的名称或将其删除,您就可以从浏览器中看到 localhost 中的目录和文件

does someone knows which versions are? or how to solve the problem?

有人知道是哪个版本吗?或者如何解决问题?

采纳答案by Nims Patel

If you want to display directory than edit htdocs/index.phpfile

如果要显示目录而不是编辑htdocs/index.php文件

Below code is display all directory in table

下面的代码是显示表中的所有目录

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Welcome to Nims Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="server/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- START PAGE SOURCE -->
<div id="wrap">
  <div id="top">
    <h1 id="sitename">Nims <em>Server</em> Directory list</h1>
    <div id="searchbar">
      <form action="#">
        <div id="searchfield">
          <input type="text" name="keyword" class="keyword" />
          <input class="searchbutton" type="image" src="server/images/searchgo.gif"  alt="search" />
        </div>
      </form>
    </div>
  </div>

<div class="background">
<div class="transbox">
<table width="100%" border="0" cellspacing="3" cellpadding="5" style="border:0px solid #333333;background: #F9F9F9;"> 
<tr>
<?php
//echo md5("saketbook007");

//File functuion DIR is used here.
$d = dir($_SERVER['DOCUMENT_ROOT']); 
$i=-1;
//Loop start with read function
while ($entry = $d->read()) {
if($entry == "." || $entry ==".."){
}else{
?>
<td  class="site" width="33%"><a href="<?php echo $entry;?>" ><?php echo ucfirst($entry); ?></a></td>  
<?php 
}
if($i%3 == 0){
echo "</tr><tr>";
}
$i++;
}?>
</tr> 
</table>

<?php $d->close();
?> 

</div>
</div>
</div>
   </div></div></body>
</html>

Style:

风格:

@import url("fontface.css");
* {
    padding:0;
    margin:0;
}
.clear {
    clear:both;
}

body {
    background:url(images/bg.jpg) repeat;
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
    color:#212713;
}
#wrap {
    width:1300px;
    margin:auto;
}

#sitename {
    font: normal 46px chunk;
    color:#1b2502;
    text-shadow:#5d7a17 1px 1px 1px;
    display:block;
    padding:45px 0 0 0;
    width:60%;
    float:left;
}
#searchbar {
    width:39%;
    float:right;
}
#sitename em {
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
}
#top {
    height:145px;
}
img {

    width:90%;
    height:250px;
    padding:10px;
    border:1px solid #000;
    margin:0 0 0 50px;
}


.post h2 a {
    color:#656f42;
    text-decoration:none;
}
#searchbar {
    padding:55px 0 0 0;
}
#searchfield {
    background:url(images/searchbar.gif) no-repeat;
    width:239px;
    height:35px;
    float:right;
}
#searchfield .keyword {
    width:170px;
    background:transparent;
    border:none;
    padding:8px 0 0 10px;
    color:#fff;
    display:block;
    float:left;
}
#searchfield .searchbutton {
    display:block;
    float:left;
    margin:7px 0 0 5px;
}

div.background
{
  background:url(h.jpg) repeat-x;
  border: 2px solid black;

  width:99%;
}
div.transbox
{
  margin: 15px;
  background-color: #ffffff;

  border: 1px solid black;
  opacity:0.8;
  filter:alpha(opacity=60); /* For IE8 and earlier */
  height:500px;
}

.site{

border:1px solid #CCC; 
}

.site a{text-decoration:none;font-weight:bold; color:#000; line-height:2}
.site:hover{background:#000; border:1px solid #03C;}
.site:hover a{color:#FFF}

Output : enter image description here

输出 : 在此处输入图片说明

回答by remking

Wanna a list of folder in xampp?

想要 xampp 中的文件夹列表?

Just delete or change the file index.php to index.txt. And you will get the list just typing url: localhost.

只需将文件 index.php 删除或更改为 index.txt。您只需键入 url: localhost 即可获得列表。

Browser screenshot

浏览器截图

回答by Razor

Here's what's actually happening localhost means that you want to open htdocs. First it will search for any file named index.php or index.html. If one of those exist it will open the file. If neither of those exist then it will open all folder/file inside htdocs directory which is what you want.

这是实际发生的事情 localhost 意味着您要打开 htdocs。首先它将搜索任何名为 index.php 或 index.html 的文件。如果其中之一存在,它将打开该文件。如果这些都不存在,那么它将打开 htdocs 目录中的所有文件夹/文件,这正是您想要的。

So, the simplest solution is to rename index.php or index.html to index2.php etc.

因此,最简单的解决方案是将 index.php 或 index.html 重命名为 index2.php 等。

回答by Matiur Rahman Mozumdar

Try this solution:

试试这个解决方案:

Go to->

前往->

  1. xammp ->htdocs-> then open index.php from the htdocs folder
  2. you can modify the dashboard
  3. restart the server
  1. xammp ->htdocs-> 然后从 htdocs 文件夹中打开 index.php
  2. 您可以修改仪表板
  3. 重启服务器

Example Code index.php :

示例代码 index.php :

    <?php
    if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
        $uri = 'https://';
    } else {
        $uri = 'http://';
    }
    $uri .= $_SERVER['HTTP_HOST'];
    header('Location: '.$uri.'/dashboard/');
    exit;
   ?>

回答by gwapo

Type in your URL localhost/[name of your folder in htdocs]

输入您的 URL localhost/[您在 htdocs 中的文件夹名称]