defining web root in php for all files access -


i've been trying work around this: in file structure this:

root: -----index.php (file inside root) -----template (folder inside root) -----user (folder inside root) -----products (folder inside root) -----config (folder inside root) 

i've been trying use dirname(dirname(__file__)) inside file in config folder define webroot constant not working well, if try access files other folders, it's calling webroot current folder instead of going root. pls can any1 me code/logic defining web root in situation this. thanks.

you can use "define":

define('root', '/home/username/public_html/'); 

then, in page page defined in included:

echo root; 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -