Page 1 of 1

Get current file name

Posted: Tue Feb 27, 2007 8:35 pm
by ngolehung84
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello,
How can I get the current file name which I am writing on?
For ex:

<this_filename.php>

Code: Select all

<?php

$this_file_name = //what is the code to get the string "this_filename.php"

?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Feb 27, 2007 9:40 pm
by feyd
The filename where it is called: __FILE__
The filename where PHP started execution: $_SERVER['PATH_TRANSLATED'], typically.