Re: A simple instruction
| From: | Justin French | Date: | Fri, 02 Jan 2004 06:17:58 +0000 |
| Subject: | Re: A simple instruction | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173623@lists.php.net to get a copy of this message | ||
On Friday, January 2, 2004, at 09:30 AM, Dino Costantini wrote:
i have a file name with the path ex food/italy/pizza/margherita.php. how can i obtain the name of the file in this case "margherita.php" i know there is a function, but i don't remember it. thx<?=$_SERVER['PHP_SELF']?> ... will echo something like... food/italy/pizza/margherita.php If you need just margherita.php, then you can explode() the string on '/', and take the last element: <? $pathBits = explode('/',$_SERVER['PHP_SELF']); echo $file = $pathBits[count($pathBits)-1]; ?> To look for other useful vars, try <pre><? print_r($_SERVER); ?></pre> Justin French