![]() |
|
|
+ Search |
![]()
|
Jun 20th, 2001 07:22
Philip Olson, Ben Udall, Peter van Beelen,
One can usually find the filename in the predefined variable
$PHP_SELF. Check your server settings with phpinfo() to be sure then
consider using the basename() function :
http://www.php.net/manual/function.basename.php
Here's an example straight out of the manual :
$path = "/home/httpd/html/index.php3";
$file = basename ($path); // $file is set to "index.php3"
Using $PHP_SELF as opposed to $path should do the trick. For more
information on predefined variables, have a look here :
http://www.php.net/manual/language.variables.predefined.php
You may also be interested in PHP's Constants, such as __FILE__, which
can be read about here :
http://www.php.net/manual/language.constants.php
Running phpinfo() will tell you which contants and predefined variables
are available on your server, have fun!