简体   繁体   English

在php中设置__DIR__路径

[英]setting up __DIR__ path in php

Here is is output of my directory path 这是我的目录路径的output

echo(__DIR__);

/Users/tsrinivas/www/Album/module/photos/view/photos/photos /用户/ tsrinivas / www /相册/模块/照片/视图/照片/照片

but i want to point 4 directories before,output should look something like. 但我想指向4目录之前,输出应类似于。

/Users/tsrinivas/www/Album/public/images/upload/ /用户/ tsrinivas / www /相册/ public / images / upload /

how to achieve this? 如何做到这一点?

You can traverse the directory tree using .. down 5 blocks and add the rest of your path 您可以使用..向下遍历5个块遍历目录树,并添加其余路径

$path = __DIR__ . "../../../../../public/images/upload/";

or place __DIR__ in a file that is located in /Users/tsrinivas/www/Album/public/images/upload/ 或将__DIR__放在/Users/tsrinivas/www/Album/public/images/upload/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM