How to get the page name of the current URL?

Using this script you can get PHP current page from a url.

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

echo "The current page name is ".CPageName();
Share

Leave a Reply

Your email address will not be published. Required fields are marked *