Note Submitter: opez.org
----
I couldn't find a better way... Here is a simple line of code that will give you the path to the current file/script:
<?php
$path_only = implode("/", (explode('/', $_SERVER["SCRIPT_FILENAME"], -1)));
print $path_only; // /home/worldpeace/public_html/test
print $_SERVER["SCRIPT_FILENAME"]; // /home/worldpeace/public_html/test/test.php
?>
I use this to build INCLUDE commands that call a file determined by a variable [ path + / + file ]. Dont forget the /
I hope this inspires someone.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.