Getting relative path from absolute path in PHP
- by SpawnCxy
I noticed that there're some similar questions about this problem when I typed the title,but they seem not be in PHP.So what's the solution to it with a PHP function?
To be specified.
$a="/home/apache/a/a.php";
$b="/home/root/b/b.php";
$relpath = getRelativePath($a,$b);//needed function,should return '../../root/b/b.php'
Any good ideas?Thanks.