Home  >  Article  >  Backend Development  >  How to get the file name of the current page using php

How to get the file name of the current page using php

不言
不言Original
2018-07-09 17:54:014919browse

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[&#39;PHP_SELF&#39;],strrpos($_SERVER[&#39;PHP_SELF&#39;],&#39;/&#39;)+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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn