How to get the page name of the current URL? Leave a reply 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();