Jump to content

Unable to understand code in config file


raydona

Recommended Posts

Hi,

I'm new to PHP, so please bear with me. I've just downloaded an application. The following is part of PHP code in a config file that came with the application:

// setting up the web root and server root for
// this application
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];

$webRoot  = str_replace(array($docRoot, 

'library/config.php'), '', $thisFile);
$srvRoot  = str_replace('library/config.php', '', 

$thisFile);

define('WEB_ROOT', $webRoot);
define('SRV_ROOT', $srvRoot);

I don't know what are web root, server root or DOCUMENT_ROOT. Would it be possible to explain what this code is designed to do. Am I required to insert anything or make any alterations? I would be grateful for all help.

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.