How to check the path of php file

藏色散人
Release: 2023-02-25 14:32:01
Original
4059 people have browsed it

How to check the path of php file

How to check the path of php file?

__FILE__ means the absolute path of the current file including the file name, dirname (__FILE__) represents the absolute path of the current file.

dirname(__FILE___) function returns the path where the script is located.

For example, the file b.php contains the following content:

<?php
$basedir = dirname(__FILE__);
?>
Copy after login

If b.php is referenced by the a.php file require or include in other directories.

The content of the variable $basedir is still the path to the folder where b.php is located.

Instead of becoming the directory where the a.php file is located.

For more PHP related knowledge, please visit PHP Tutorial!

The above is the detailed content of How to check the path of php file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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