Home > php教程 > php手册 > php求两个目录的相对路径示例

php求两个目录的相对路径示例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:39:59
Original
1095 people have browsed it

 这篇文章主要介绍了php求两个目录的相对路径示例(php获取相对路径),需要的朋友可以参考下

求两个目录的相对路径,不限制路径深度    代码如下: /**  * 输出$b相对于$a的相对路径($a)  * 不限限制路径深度,没有做什么优化,只是实现功能  */ function getPath($a, $b) {  $aArr = explode('/', dirname($a));  $bArr = explode('/', dirname($b));    $aLen = count($aArr);  $bLen = count($bArr);    $len = max($aLen, $bLen);    $k = 0;    for($i = 0; $i
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template