Site icon Student Project Guidance & Development

How to get current page name in PHP?

current page name

To get the current page URL that is shown in the browser URL window.

Ex: You can now get the current page URL using the line: <?php echo curPageURL(); ?>

This is the method to return the current page file name. Using basename() function and $_SERVER['PHP_SELF'] variable you can get current page name.

<?php echo basename($_SERVER['PHP_SELF']); ?> 
Exit mobile version