欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

wampserver能启动localhost但不能打开自己的项目如何解决?

程序员文章站 2022-09-11 09:27:38
www目录下找到index.php,修改如下代码: 修改前: while (($file = readdir($handle))!==false) { if (...

www目录下找到index.php,修改如下代码:

修改前:

while (($file = readdir($handle))!==false)
{
    if (is_dir($file) && !in_array($file,$projectsListIgnore))
    {
        $projectContents .= '<li><a href="';
        if($suppress_localhost)
            $projectContents .= 'https://'.$file.$UrlPort.'/"';  //需要改动的地方
        else
            $projectContents .= 'https://localhost'.$UrlPort.'/'.$file.'/"';
        $projectContents .= '>'.$file.'</a></li>';
    }
}

修改后:

while (($file = readdir($handle))!==false)
{
    if (is_dir($file) && !in_array($file,$projectsListIgnore))
    {
        $projectContents .= '<li><a href="';
        if($suppress_localhost)
            $projectContents .= 'https://localhost/'.$file.$UrlPort.'/"';  //改动后的
        else
            $projectContents .= 'https://localhost/'.$UrlPort.'/'.$file.'/"';
        $projectContents .= '>'.$file.'</a></li>';
    }
}

重新启动wampserver即可打开。