无法访问 127.0.0.1 站点。连接重置
我正在尝试删除文件夹并重新创建新文件夹并填充新文件
我的 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
"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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论