Get Current File Name in PHP
In PHP, you can use basename(__FILE__) to get the current file name being executed. This method will return the basic name part of the current script file. Here is a simple example code:
<?php
$currentFileName = basename(__FILE__);
echo "当前文件名是:$currentFileName";
?>
In the example above, calling basename(__FILE__) will return the base name portion of the current script file, which is then echoed out using the echo statement. You can directly run this code and it will display the name of the PHP file currently being executed.