使用PHP计算两个路径的相对路径
复制代码 代码如下:<html> <body> <?php function relativePath($aPath, $bPath) { $aArr = explode(‘/’, $aPath); //explode函数用于切分字符串,返回切分后的数组,此处用’/’切分字符串 $bArr = explode(‘/’, $bPath); $aDiffToB = array_diff_assoc($aArr, $bAr
复制代码 代码如下:<html> <body> <?php function relativePath($aPath, $bPath) { $aArr = explode(‘/’, $aPath); //explode函数用于切分字符串,返回切分后的数组,此处用’/’切分字符串 $bArr = explode(‘/’, $bPath); $aDiffToB = array_diff_assoc($aArr, $bAr