This is a discussion on Get Pagename From URL within the PHP forums, part of the Programming Talk category; hi,
How to get the page name from the Url.For Example My urls is like exforsys . com/viewtopic.php
Then how ...
<?php
$path = "/home/httpd/html/index.php";
$file = basename($path); // $file is set to "index.php"
$file = basename($path, ".php"); // $file is set to "index"
?>