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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.