The above PHP variables have slight differences which are often ignored, often leading to problems in large scale deployments or product solutions. Les variables PHP ont de légères différences qui sont souvent ignorées, ce qui entraîne souvent des problèmes dans des déploiements à grande échelle de produits ou de solutions. I have attempted to debug them for you. J'ai essayé de déboguer pour vous.

$_SERVER['SCRIPT_NAME'] $ _SERVER [ 'SCRIPT_NAME']
This contains the current script’s path. Celui-ci contient le script courant du chemin. If you access Si vous accédez http://blog.taragana.com/ or ou http://blog.taragana.com/index.php the $_SERVER['SCRIPT_NAME'] will be same - /index.php . $ _SERVER [ 'SCRIPT_NAME'] sera même - / index.php. It is irrespective of the actual URI ($_SERVER['REQUEST_URI']) used to access the site. Il est quel que soit le URI ($ _SERVER [ 'REQUEST_URI']) utilisés pour accéder au site.

As it returns the actual script name, it fails provide additional path information that may be present. Comme elle retourne le nom de script, il ne parvient pas fournir des informations de chemin que la présence mai. So if the $_SERVER['REQUEST_URI'] is /index.php/big/directory/ then too the $_SERVER['SCRIPT_NAME'] will be same - /index.php . Ainsi, si l'$ _SERVER [ 'REQUEST_URI'] est / index.php / big / répertoire / alors trop le $ _SERVER [ 'SCRIPT_NAME'] sera même - / index.php.

$_SERVER['SCRIPT_NAME'] is supported on all platforms $ _SERVER [ 'SCRIPT_NAME'] est pris en charge sur toutes les plates-formes

$_SERVER['PHP_SELF'] $ _SERVER [ 'PHP_SELF']
This is the filename of the currently executing script, relative to the document root. C'est le nom de fichier du script en cours d'exécution, par rapport à la racine du document. However, unlike $_SERVER['SCRIPT_NAME'], it provides additional path information like $_SERVER['REQUEST_URI'] when the actual php file is present in the path. Toutefois, à la différence de $ _SERVER [ 'SCRIPT_NAME'], il fournit des informations de chemin comme $ _SERVER [ 'REQUEST_URI'] lorsque le fichier php est présent dans le chemin. So when the $_SERVER['REQUEST_URI'] is /index.php/big/directory/ then $_SERVER['PHP_SELF'] will be /index.php/big/directory/ . Ainsi, lorsque l'$ _SERVER [ 'REQUEST_URI'] est / index.php / big / répertoire / alors $ _SERVER [ 'PHP_SELF'] sera / index.php / big / répertoire /.
However if all the URI’s under http://www.example.com/ is mapped to http://www.example.com/index.php, then, for example, http://www.example.com/abc/def will return /index.php like $_SERVER['SCRIPT_NAME']. Toutefois, si tous les URI de la sous http://www.example.com/ est mis en correspondance avec http://www.example.com/index.php, puis, par exemple, http://www.example.com/ abc / def sera de retour / index.php like $ _SERVER [ 'SCRIPT_NAME']. Note that $_SERVER['REQUEST_URI'] data is ignored for this request. Note that $ _SERVER [ 'REQUEST_URI'] n'est pas pris en compte les données pour cette demande.

$_SERVER['PHP_SELF'] is supported on all platforms. $ _SERVER [ 'PHP_SELF'] est pris en charge sur toutes les plates-formes.

Pages: 1 Pages: 1 2