Get current page file name with PHP

Free Scripts :: PHP :: String :: Get current page file name with PHP

Author: Salman Javaid

Website: http://www.salman.be

  • How to get current webpage file name with PHP.
  • Custom PHP function get current page name.

Function returns the name of currently opened page.

Function

function getPageName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}

Calling The Function

echo getPageName();

Output

login.php

Comments

No comments. Be the first one.

Leave a comment

Full Name*
Comments*
Security Code*

Our Partners

Getty Icons  Salman Creations
Free High Quality Images  Learn Free Languages 
Opal Hosting  R-Tech Solutions
  • Submit a Script

    Click here to submit your script.