twitter
    Find out what I'm doing, Follow Me :)
If you have any question, suggestion or article topic for me to write, feel free to contact me through my shout box. ;) Some time I need an idea to write. hehe Hopefully I can help you and share my expertise.

php how to get real path for virtual directory

for the normal site you can use

echo $_SERVER['DOCUMENT_ROOT'];

to get absolute path of root.
I had a problem to get absolute path when I put my code inside virtual/alias directory. when I use echo $_SERVER['DOCUMENT_ROOT']; , it will return absolute path for document root. Not my virtual directory.

How ever, here is the solution for my problem.

echo realpath('./');

0 comments:

Post a Comment