<?php
$path = $_SERVER["SCRIPT_NAME"];
$file = basename($path); // $file is set to "myfile.php"
$file = basename($path, ".php"); // $file is set to "myfile"
?>
<?
$currentFile = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $currentFile);
$parts = array_reverse($parts);
echo("Script is " . $parts[0]);
?>



4 comments:
Thanks for the helpful post. This is what I need!
This is a great website post. cheers very much for the great insight and we really appreciate the time you took to write this.
so simply!! amazing...two minutes and everithing works well again!! thanks a lot
I think this computer Get Current File Name using PHP is much more effective than the other one.
Post a Comment