Get .PHP Filename?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Freshour

    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...

  • Terry Austin

    #2
    Re: Get .PHP Filename?

    Ralph Freshour <ralph@primemai l.com> wrote in
    news:21rvlvo3cr ema1kiontqaklkl 8len3230r@4ax.c om:
    [color=blue]
    > 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?
    >[/color]
    $_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
    taustin@hyperbo oks.com

    Comment

    • Randell D.

      #3
      Re: Get .PHP Filename?


      "Ralph Freshour" <ralph@primemai l.com> wrote in message
      news:21rvlvo3cr ema1kiontqaklkl 8len3230r@4ax.c om...[color=blue]
      > 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...
      >[/color]

      $_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.


      Comment

      • Rainer Erismann

        #4
        Re: Get .PHP Filename?


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

        $_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__.


        Comment

        • Matthias Esken

          #5
          Re: Get .PHP Filename?

          Ralph Freshour <ralph@primemai l.com> schrieb:
          [color=blue]
          > 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?[/color]

          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

          Comment

          Working...