Paragon Jenko
Paragon Jenko

Reputation: 91

Setting ROOT directory in PHP

Within my PHP I wish to instead of using ../ I want to be able to just use ROOT/Directory/File

My host's actual root is filled with a variety of files therefore it is difficult to do it through the actual way.

I want a file path to be for example:

ACTUALROOT/WEBSITEROOT/DIR/DIR/FILE

The documentation on using DIR is incredibly confusing can anyone clear this up in a logical way?

Upvotes: 0

Views: 408

Answers (1)

fortune
fortune

Reputation: 3382

From php manual:

__DIR__ The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname (__FILE__). This directory name does not have a trailing slash unless it is the root directory.

Upvotes: 1

Related Questions