Created
April 16, 2022 17:17
-
-
Save fishyer/353c13026c0fad06d6c046bb4e6542ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root=__DIR__.'/static'; //全站目录 | |
// print_r ($root); | |
function my($dir){ | |
static $item_arr=array(); | |
$a=scandir($dir); | |
foreach($a as $k=>$v){ | |
if($v=='.'|| $v=='..') continue; | |
$v=$dir.'/'.$v; | |
if(is_dir($v)){ | |
my($v); | |
}else{ | |
$path=dirname($v); | |
$item_arr[]=$path; | |
} | |
} | |
return $item_arr; | |
} | |
$b=array_unique(my($root)); | |
foreach($b as $k=>$v){ | |
//print_r(glob($v.'/*.php')); //输出全站php文件 | |
//print_r(glob($v.'/*.html')); //输出全站html文件 | |
$array = glob($v.'/*.html'); | |
// print_r ($array); | |
foreach ($array as $key=>$value){ | |
$name=str_replace("/www/wwwroot/sspai.fishyer.com/static","",$value); | |
$link=str_replace("/www/wwwroot/sspai.fishyer.com","",$value); | |
echo "<a href='".$link."' >$name</a><br>"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment