469,336 Members | 5,556 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Get .PHP Filename?

I've been looking thru my PHP functions and can't find what I need -
is there a function that will tell me what .php file is currently
executing?

Thanks...

Jul 16 '05 #1
4 23794
Ralph Freshour <ra***@primemail.com> wrote in
news:21********************************@4ax.com:
I've been looking thru my PHP functions and can't find what I need -
is there a function that will tell me what .php file is currently
executing?

$_GET['SCRIPT_NAME'] will give you the current path, without any GET data.
I think.

$_GET['REQUEST_URI'] will give you the full URI, including any GET data.

--
Larry Flynt for Governor!
Bringing dignity back to the Governor's Mansion

Terry Austin
ta*****@hyperbooks.com
http://www.hyperbooks.com/
Jul 16 '05 #2

"Ralph Freshour" <ra***@primemail.com> wrote in message
news:21********************************@4ax.com...
I've been looking thru my PHP functions and can't find what I need -
is there a function that will tell me what .php file is currently
executing?

Thanks...


$_SERVER['PHP_SELF'] is just one of a number that could tell you what you
want... A whole host of other interesting values are available if you just
call phpinfo(); and check the output (which is in a nice clean table). Note
though that some variables are sent by the client (browser) and not all
clients (browsers) send the same amount of data (ie some reveal more
information, others don't - and some (like me) who have Norton Internet
Security 2003 have some of the headers sent by the client removed before
they hit the server (meaning minimum amount of data).

But if its just findiing out about server side values, then you should/can
rely on phpinfo(); to help you out.
Jul 16 '05 #3

"Ralph Freshour" wrote: I've been looking thru my PHP functions and can't
find what I need -
is there a function that will tell me what .php file is currently
executing?


$_SERVER['PHP_SELF'] is the 'parent' script you are executing. If you
include several files into it, $_SERVER['PHP_SELF'] would still be the
same.
If you need the filename of included files into themselfs, use __FILE__.
Jul 16 '05 #4
Ralph Freshour <ra***@primemail.com> schrieb:
I've been looking thru my PHP functions and can't find what I need -
is there a function that will tell me what .php file is currently
executing?


Use the function phpinfo() and have a look at all those variables at the
end of the page. You might get some more ideas about your task. :-)

Matthias
Jul 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Brian Gruber | last post: by
4 posts views Thread by B Squared | last post: by
10 posts views Thread by Steve | last post: by
12 posts views Thread by vj | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.