Use PHP to find the relative paths of the two files. Copy the code as follows: functioncompare ($ ph1, $ ph2) {$ ret; $ _ f1Arrexplode (, $ ph1); $ _ f2Arrexplode (, $ ph2 ); $ f1array_pop ($ _ f1Arr); $ f2array_pop ($ _ f2Arr);
The code is as follows:
Function compare ($ ph1, $ ph2 ){
$ Ret = '';
$ _ F1Arr = explode ("/", $ ph1 );
$ _ F2Arr = explode ("/", $ ph2 );
$ F1 = array_pop ($ _ f1Arr );
$ F2 = array_pop ($ _ f2Arr );
For ($ I = 0; $ I If ($ _ f1Arr [$ I]! ==$ _ F2Arr [$ I])
Break;
}
For ($ j =$ I-1; $ j $ Ret. = "../";
}
For ($ I-1; $ I $ Ret. = $ _ f2Arr [$ I]. '/';
}
Return $ ret. $ f2;
}
$ File1 = "aaa/ddd/ccc/ddd/test/a. js? 1.1.26 ";
$ File2 = "aaa/ddd/ccc/ddd/test/B. js? 1.1.26 ";
Echo compare ($ file1, $ file2 );
?>
B's relative path to...
The http://www.bkjia.com/PHPjc/327723.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327723.htmlTechArticle code is as follows: function compare ($ ph1, $ ph2) {$ ret = ''; $ _ f1Arr = explode ("/", $ ph1 ); $ _ f2Arr = explode ("/", $ ph2); $ f1 = array_pop ($ _ f1Arr); $ f2 = array_pop ($ _ f2Arr);...