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

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

不言
Release: 2023-04-02 21:54:01
Original
5021 people have browsed it

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;
}
?>
Copy after login

How to use the function:

<?php
    $phpself=php_self();
    echo $phpself;
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template