This article mainly introduces how to obtain the file name of the current page in PHP. It has certain reference value. Now I share it with you. Friends in need can refer to it.
Due to development needs, it is often necessary to obtain the current page file name. The file name of the php file. The method of getting the current file name in php is very simple. The program code is as follows:
<?php function php_self(){ $php_self=substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1); return $php_self; } ?>
How to use the function:
<?php $phpself=php_self(); echo $phpself; ?>
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
php Reasons and solutions for large file upload failure
PHP simply implements sending emails and preventing Treated as spam
The above is the detailed content of How to get the file name of the current page using php. For more information, please follow other related articles on the PHP Chinese website!