Pages

How to get the name of PHP script

To extract the name of the currently executed script from the URL, The PHP superglobal array $_SERVER can be used.The example below describes the procedure.

<?php
$currentscript = $_SERVER["PHP_SELF"];
echo $currentscript;
?>


The PHP code above will show the name of only the PHP script currently executed.Sometimes it is necessary only to get the name of the PHP script instead of complete URL.

 

0 comments:

Post a Comment