List Info

Thread: How to define the webroot??Help me




How to define the webroot??Help me
country flaguser name
United States
2007-11-05 00:11:48
I have got this code from PHP tutorial on the website.

$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 can't understand the meaning of the line -->$thisFile
=
str_replace('', '/', __FILE__);

I know the function str_replace.

I want to know what should be the file"__FILE__"
here??

Plz describe briefly as I can understand.


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


Re: How to define the webroot??Help me
country flaguser name
United States
2007-11-05 02:31:19
Hello,

I think perhaps the script was pasted in here incorrectly? 
The back-
slash should be escaping the single quote, therefore causing
an
error.  Thats my initial thought at least.

Perhaps you'd like to explain the usage of WEB_ROOT and
SRV_ROOT?

You might also want to check out the 'dirname' function in
PHP - you
would be able to use that to easily determine a location of
the
current file...


On Nov 5, 12:11 am, rinku <Rinku.n...gmail.com> wrote:
> I have got this code from PHP tutorial on the website.
>
> $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 can't understand the meaning of the line
-->$thisFile =
> str_replace('', '/', __FILE__);
>
> I know the function str_replace.
>
> I want to know what should be the
file"__FILE__" here??
>
> Plz describe briefly as I can understand.


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


Re: How to define the webroot??Help me
country flaguser name
United States
2007-11-05 03:04:53
Hi!,

"__FILE__" is a reserved keyword under PHP and
returns the filename of
the script that is currently being run.

Hope this will help you.

Ojasvi.

On Nov 5, 11:11 am, rinku <Rinku.n...gmail.com> wrote:
> I have got this code from PHP tutorial on the website.
>
> $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 can't understand the meaning of the line
-->$thisFile =
> str_replace('', '/', __FILE__);
>
> I know the function str_replace.
>
> I want to know what should be the
file"__FILE__" here??
>
> Plz describe briefly as I can understand.


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )