obtaining filename

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tommy1987
Forum Commoner
Posts: 92
Joined: Tue Feb 21, 2006 8:35 pm

obtaining filename

Post by tommy1987 »

Can anyone point me in the right direction, I want to obtain the filename (e.g. index.php)

Then I can do:

Code: Select all

if($fileName == index.php) {
                   //Shade home button because we are there.
}
klarinetking
Forum Commoner
Posts: 59
Joined: Mon Jul 24, 2006 9:43 am

Post by klarinetking »

You mean getting the filename from the URL? Take a look at $_SERVER.

See what this code produces.

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Or just use __FILE__
Post Reply