|
| $_SERVER['PHP_SELF']
The $_SERVER['PHP_SELF'] variable tells you the file name of the current script.
Use as follows:
echo $_SERVER['PHP_SELF'];
Example 1:
Suppose the url you are accessing is http://www.somesite.com/play.php, the if you echo $_SERVER['PHP_SELF'], you will get:
/play.php
Note that any url parameters are discarded. For example, for url http://www.somesite.com/display.php?id=345, using $_SERVER['PHP_SELF'] will return just:
/display.php
Using the $_SERVER['PHP_SELF'] on this page will output the following file name of this script:
/e/1/php/php-self.php
See also:
|
|