Jump to content

question about PHP_SELF and SCRIPT_NAME


yong

Recommended Posts

i look some codes like :

 

$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];

 

when i test in my computer like

 

<?php

var_dump($_SERVER['PHP_SELF']);
var_dump($_SERVER['SCRIPT_NAME']);

?>


 

is was print :string(14) "/test/demo.php" string(12) "/php/php.exe";

 

just like you see the both are not same.

 

so i want to know ...why?

 

why the $_server['script_name'] and the $_server['php_self'] are different?

 

thinks..

Link to comment
https://forums.phpfreaks.com/topic/45241-question-about-php_self-and-script_name/
Share on other sites

'PHP_SELF' = The filename of the currently executing script, relative to the document root

If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.

 

'SCRIPT_NAME' = Contains the current script's path

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.