Write a PHP script to get the current file name
PHP script to get the current file name you just need one method and one global variable
1.basename(path):The basename() function returns the filename from a path.
2.$_SERVER['PHP_SELF']:-it is used for get current path of file.
code:-
<?php
$filename = basename($_SERVER['PHP_SELF']);
echo filename."\n";
?>
output:-
index.php
Post a Comment
If you have any doubts, Please let me know
Thanks!