The above PHP variables have slight differences which are often ignored, often leading to problems in large scale deployments or product solutions. Las anteriores variables han PHP pequeñas diferencias que a menudo son ignoradas, que a menudo provoca problemas en los despliegues a gran escala de productos o soluciones. I have attempted to debug them for you. He tratado de depurar por usted.

$_SERVER['SCRIPT_NAME'] $ _SERVER [ 'SCRIPT_NAME']
This contains the current script’s path. Este contiene la secuencia de comandos del actual camino. If you access Si accede http://blog.taragana.com/ or o http://blog.taragana.com/index.php the $_SERVER['SCRIPT_NAME'] will be same - /index.php . los $ _SERVER [ 'SCRIPT_NAME'] va a ser el mismo - / index.php. It is irrespective of the actual URI ($_SERVER['REQUEST_URI']) used to access the site. Es independientemente de la URI real ($ _SERVER [ 'REQUEST_URI']) utilizados para acceder al sitio.

As it returns the actual script name, it fails provide additional path information that may be present. Como se devuelve el nombre real de script, no proporcionar información adicional sobre la ruta que pueden estar presentes. So if the $_SERVER['REQUEST_URI'] is /index.php/big/directory/ then too the $_SERVER['SCRIPT_NAME'] will be same - /index.php . Por lo tanto, si los $ _SERVER [ 'REQUEST_URI'] es / index.php / big / directorio / entonces también los $ _SERVER [ 'SCRIPT_NAME'] va a ser el mismo - / index.php.

$_SERVER['SCRIPT_NAME'] is supported on all platforms $ _SERVER [ 'SCRIPT_NAME'] se apoya en todas las plataformas

$_SERVER['PHP_SELF'] $ _SERVER [ 'PHP_SELF']
This is the filename of the currently executing script, relative to the document root. Este es el nombre del fichero actualmente la ejecución de secuencias de comandos, relativo al documento raíz. However, unlike $_SERVER['SCRIPT_NAME'], it provides additional path information like $_SERVER['REQUEST_URI'] when the actual php file is present in the path. Sin embargo, a diferencia de $ _SERVER [ 'SCRIPT_NAME'], que proporciona información adicional sobre la ruta como $ _SERVER [ 'REQUEST_URI'] cuando el archivo php está presente en el camino. So when the $_SERVER['REQUEST_URI'] is /index.php/big/directory/ then $_SERVER['PHP_SELF'] will be /index.php/big/directory/ . Así que cuando el $ _SERVER [ 'REQUEST_URI'] es / index.php / big / directorio / entonces $ _SERVER [ 'PHP_SELF'] será / index.php / big / directory /.
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']. Sin embargo, si todas las URI en virtud del http://www.example.com/ está asignada a http://www.example.com/index.php, entonces, por ejemplo, http://www.example.com/ abc / def volverá / index.php como $ _SERVER [ 'SCRIPT_NAME']. Note that $_SERVER['REQUEST_URI'] data is ignored for this request. Tenga en cuenta que $ _SERVER [ 'REQUEST_URI'] se pasa por alto los datos de esta solicitud.

$_SERVER['PHP_SELF'] is supported on all platforms. $ _SERVER [ 'PHP_SELF'] se apoya en todas las plataformas.

Pages: 1 Páginas: 1 2