写入两个文件的相对路径 $b相对$a的绝对路径
$a = '/a/b/c/d/e.php';
$b = '/a/b/12/34/c.php';
function getRelativelyPath($b, $a){
$b = explode('/', $b);
$a = explode('/', $a);
$c = array_diff($b,$a);
$d = array_diff($a, $b);
array_pop($d);
$upPathArr = array_fill(0,count($d),'..');
$pathArr = array_merge($upPathArr, $c);
return join('/',$pathArr);
}
写出两个文件的相对路径
最新推荐文章于 2020-10-03 13:23:19 发布