无法访问 127.0.0.1 站点。连接重置

发布于 2025-01-11 20:50:44 字数 2067 浏览 0 评论 0原文

我正在尝试删除文件夹并重新创建新文件夹并填充新文件

我的 PHP 代码如下

<?php 
set_time_limit(0);

function delete_files($dir) {
  if (is_dir($dir)) {
    $objects = scandir($dir);
    foreach ($objects as $object) {
      if ($object != "." && $object != "..") {
        if (filetype($dir."/".$object) == "dir") 
           delete_files($dir."/".$object); 
        else{if(is_file($dir."/".$object)){ unlink   ($dir."/".$object);}}
      }
    }
    reset($objects);
    rmdir($dir);
  }
 }


function recurse_copy($dir,array $scmum){
//  var_dump($scmum);
        foreach($scmum as $scf){
            if(!is_dir($scf) && $scf!='.htaccess' && $scf!='.' && $scf!='..'){
                if(copy("$basedir/$scf","$dir/$scf")){
                    if(is_file("$dir/.htaccess")){
                            unlink("$dir/.htaccess");
                        }
                        echo "$dir/$scf Copied<br>";
                }else{
                    $e=error_get_last();echo "Error 0 :".$e['message']."<br>";
                }
            }
                else{
                    recurse_copy($scf,$scmum);
                }
            }
    }

$basedir="subdomainfiles";
$scmum=scandir($basedir); 
include('connnew.php');
$getcities=$maindb->query("SELECT Location from clientdata GROUP BY Location ORDER BY Location ASC") or die($maindb->error);
while($infocit=$getcities->fetch_assoc()){
    $cityU=UCfirst(strtolower(str_replace(array(" ",","),"-",$infocit['Location'])));
    $cityL=strtolower(str_replace(array(" ",","),"-",$infocit['Location']));
    $title=$cityU;
    if(is_dir($cityU)){delete_files($cityU);}
    if(is_dir($cityL)){delete_files($cityL);}
    mkdir($cityL,0777,true);
//  var_dump($scmum);
    recurse_copy($cityL,$scmum);    
}

但是,我收到上述标题错误。屏幕截图如下

错误页面

“无法访问此站点,连接已重置。尝试:

检查连接检查代理和防火墙正在运行 Windows 网络诊断 ERR_CONNECTION_RESET"

这可能是由于函数循环造成的吗?

I am trying to delete folders and recreate new and populate with new files

My PHP Code is as below

<?php 
set_time_limit(0);

function delete_files($dir) {
  if (is_dir($dir)) {
    $objects = scandir($dir);
    foreach ($objects as $object) {
      if ($object != "." && $object != "..") {
        if (filetype($dir."/".$object) == "dir") 
           delete_files($dir."/".$object); 
        else{if(is_file($dir."/".$object)){ unlink   ($dir."/".$object);}}
      }
    }
    reset($objects);
    rmdir($dir);
  }
 }


function recurse_copy($dir,array $scmum){
//  var_dump($scmum);
        foreach($scmum as $scf){
            if(!is_dir($scf) && $scf!='.htaccess' && $scf!='.' && $scf!='..'){
                if(copy("$basedir/$scf","$dir/$scf")){
                    if(is_file("$dir/.htaccess")){
                            unlink("$dir/.htaccess");
                        }
                        echo "$dir/$scf Copied<br>";
                }else{
                    $e=error_get_last();echo "Error 0 :".$e['message']."<br>";
                }
            }
                else{
                    recurse_copy($scf,$scmum);
                }
            }
    }

$basedir="subdomainfiles";
$scmum=scandir($basedir); 
include('connnew.php');
$getcities=$maindb->query("SELECT Location from clientdata GROUP BY Location ORDER BY Location ASC") or die($maindb->error);
while($infocit=$getcities->fetch_assoc()){
    $cityU=UCfirst(strtolower(str_replace(array(" ",","),"-",$infocit['Location'])));
    $cityL=strtolower(str_replace(array(" ",","),"-",$infocit['Location']));
    $title=$cityU;
    if(is_dir($cityU)){delete_files($cityU);}
    if(is_dir($cityL)){delete_files($cityL);}
    mkdir($cityL,0777,true);
//  var_dump($scmum);
    recurse_copy($cityL,$scmum);    
}

However, I get the above captioned error. The screen shot is below

Error Page

"This site can’t be reached The connection was reset. Try:

Checking the connection Checking the proxy and the firewall Running
Windows Network Diagnostics ERR_CONNECTION_RESET"

Could this be because of the looping of the functions ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文