Learn Codeigniter

How to Get the Current Page Name In PHP

To get Current Page Name we will use following PHP code snippet .

Example

<?php
function currentPageName() {
 return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
echo currentPageName();
?>

Output

getpageurl.php