Friday, May 21, 2010

How to store the name of the file itself as a PHP variable?

i.e. If my page is called page.php, is there an expression in PHP such that I can use to assign 'page.php' to a variable without having to explicitly define it?

How to store the name of the file itself as a PHP variable?
Here's how.


$variable = $_SERVER["PHP_SELF"];





$variable is a variable. You may change the name instead of variable.


$_SERVER["PHP_SELF"] gets the data at the end of the link.


No comments:

Post a Comment