Devolver el path del DocumentRoot del servidor web

Código PHP

PHP – Server – Devolver Path DocumentRoot

Función que devuelve el path completo en donde apunta la variable del servidor DocumentRoot.

En este path ha de existir en archivo index, ya que también es el directorio donde apunta el dominio utilizado.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/**
* Class HelperServer
*/
abstract class HelperServer
{
/**
* Devuelve el path del servidor.
*
* @return string
*/
public static function getDocumentRoot( )
{
return HelperServer::getValue( 'DOCUMENT_ROOT' );
}
}
/** * Class HelperServer */ abstract class HelperServer { /** * Devuelve el path del servidor. * * @return string */ public static function getDocumentRoot( ) { return HelperServer::getValue( 'DOCUMENT_ROOT' ); } }
/**
 * Class HelperServer
 */
abstract class HelperServer
{
    /**
     * Devuelve el path del servidor.
     *
     * @return string
     */
    public static function getDocumentRoot( )
    {
        return HelperServer::getValue( 'DOCUMENT_ROOT' );
    }
}

Funciones relacionadas: