For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Saturday, November 08, 2014

Get Current Page Name in PHP


PROBLEM:
During coding in php, some time you need to Get Current Page Name in PHP. So How to Get Current Page Name in PHP?

SOLUTION:
Create a file "b.php" and save below content and open in browser. you will see "b.php" as page name.
<?php
function getScript() {
$file = $_SERVER["SCRIPT_NAME"];
$break = explode('/', $file);
$pfile = $break[count($break) - 1];
return $pfile;
}
echo getScript();
?>
Share:

0 comments:

Post a Comment

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip