【PHP】下らねぇ質問はID出して書き込みやがれ 90
レス数が950を超えています。1000を超えると書き込みができなくなります。
0978nobodyさん
2009/12/08(火) 00:06:57ID:???function RelativePath( $basePath , $targetPath) {
$basePath = ereg_replace("/$","",$basePath);
$targetPath = ereg_replace("/$","",$targetPath);
$basePath = ereg_replace("^/","",$basePath);
$targetPath = ereg_replace("^/","",$targetPath);
$base = explode("/",$basePath);
$target = explode("/",$targetPath);
$targetCount = count($target);
$baseCount = count($base);
for ($i=0;$i<$targetCount and $i<$baseCount;$i++){
if ( $base[$i] == $target[$i] ){
unset( $target[$i]);
unset( $base[$i]);
}
}
if (count($base) ==0)
$path ="./";
else
$path = str_repeat("../", count( $base ));
$path.= implode("/",$target);;
return $path;
}
レス数が950を超えています。1000を超えると書き込みができなくなります。