how to find out current page name from url

Discussion in 'PHP' started by dineshsingh1984, May 12, 2011.

  1. #1
    I want to echo only current page name with extenstion.........
    for example...............

    url is "example.com/test.php"

    I want to echo only "test.php"
    how can do it??????????


    plz help me...............
     
    dineshsingh1984, May 12, 2011 IP
  2. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #2
    Grit., May 13, 2011 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    jestep, May 13, 2011 IP
  4. codeartist

    codeartist Peon

    Messages:
    96
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    echo $_SERVER['SCRIPT_NAME']; should work.
     
    codeartist, May 13, 2011 IP
  5. JoelLarson

    JoelLarson Peon

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Some PHP variables off the top of my head that might do this are:

    $_SERVER['SCRIPT_FILENAME'];
    __FILE__;
    $_SERVER['REQUEST_URI'];
    PHP:
     
    JoelLarson, May 13, 2011 IP
  6. dineshsingh1984

    dineshsingh1984 Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #6
    Thanks................

    All of u.......
    It's working..........
     
    dineshsingh1984, May 13, 2011 IP