我的filemanager文件夹位于:
localhost/cakeapp/app/webroot/js/tinymce/js/tinymce/plugins/filemanager/
在cakeapp根目录中,我有两个文件夹:
uploadedImages (cakeapp/uploadedImages)
UploadedImagesThumbs (cakeapp/uploadedImagesThumbs).
我在config.php
档案中有这种情况:
$base_url ="http://localhost";
// path from base_url to base of upload folder (with start and final /)
$upload_dir = '/cakeapp/uploadedImages/';
// relative path from filemanager folder to thumbs folder (with final /)
$thumbs_base_path = '???????/uploadedImagesThumbs';
// relative path from filemanager folder to upload folder (with final /)
$current_path = '???????/uploadedImages/';
如何从filemanager文件夹中获取$thumbs_base_path
和$current_path
的正确相对路径?
答案 0 :(得分:0)
您可以尝试类似
的内容function getRelativePath($from, $to) {
$patha = explode('/', $from);
$pathb = explode('/', $to);
$start_point = count(array_intersect($patha,$pathb));
while($start_point--) {
array_shift($patha);
array_shift($pathb);
}
$output = "";
if(($back_count = count($patha))) {
while($back_count--) {
$output .= "../";
}
} else {
$output .= './';
}
return $output . implode('/', $pathb);
}
检查source。还有更多示例