Current page name

/ Published in: PHP
Save to your folder(s)

Function to return the current page name, without the location of it...
Eg, for the URL http://localhost/www/someproject/index.php, this would return index.php

Copy this code and paste it in your HTML
  1. function curPageName() {
  2. return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
  3. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.