I have a PHP file (mymainfile.php
)
inside this PHP file, i have include some other PHP files (include.php
).
The URL is:
http://www.domain.com/my/mymainfile.php
Now i want to get the URL into a variable inside the include.php
file.
All my tries with the $_SERVER
variables will give me "domain.com/my/include.php
" back and that's not what I'm looking for.
Is it possible, and if it's, how?
Have you tried getcwd()? http://php.net/manual/en/function.getcwd.php Or dirname(__FILE__) (or just __FILE__ )
Aand 1 more try
function get_file_dir() {
global $argv;
return realpath($argv[0]);
}