Jump to content

Easier method to find page name?


3raser

Recommended Posts

One of my features on my website relies on the following function that I wrote up real quick:

 

function getPage()
{
$page = preg_replace('#\/(.+)\/#', '', $_SERVER['PHP_SELF']);
$page = str_replace('/', null, $page);
return $page;
}

 

It gets the page name you're currently on. Such as: http://www.test.com/test.php - It'll return test.php

 

Is there a built in PHP method to do this?

Link to comment
https://forums.phpfreaks.com/topic/263691-easier-method-to-find-page-name/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.