Hello everyone I am trying to get the path from the current working directory but I don't want the root path included with it in PHP or wordpress. For example I have a directory structure like this.
-C
--wamp64
--------www
-----------project
------------------Other directories
Now, what exactly I want is to get the path from project directory something like this.
-project
--Other directories
Currently with __DIR__
or dirname(__FILE__)
I am getting.
C:\\wamp64\\www\\project\\other_directories
But I want to get.
\\project\\other_directories
And I wanted to make it dynamic so that it picks up the right path from which ever server I deploy this project.
I searhed alot but couldn't find the solution.
https://www.w3schools.com/php/showphp.asp?filename=demo_global_server
Check above URL and use $_SERVER['PHP_SELF'];
remove the filename from that and you will have the path relative to the document root.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.