Home >Backend Development >PHP Tutorial >The difference between __FILE__ and $_SERVER['SCRIPT_FILENAME']

The difference between __FILE__ and $_SERVER['SCRIPT_FILENAME']

WBOY
WBOYOriginal
2016-07-25 08:56:471081browse
  1. echo $_SERVER['SCRIPT_FILENAME'].'
    ';
  2. echo __FILE__;
Copy the code

Execute a.php to get:

  1. require 'a.php';
Copy the code

and execute b.php, the result is:

E:/var/www/b.php ($_SERVER['SCRIPT_FILENAME']) E:wampwwwTexta.php (__FILE__)

From this, we can draw the difference between the two: $_SERVER['SCRIPT_FILENAME'] The absolute path and file name of the currently executing program __FILE__ The absolute path and file name of the original file (included file)

Dear, do you understand? Regarding the difference between __FILE__ and $_SERVER['SCRIPT_FILENAME'], please understand the meaning contained in the above example.



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