FW: [PHP] $DOCUMENT_ROOT -- didn't work from a class..
| From: | Maxim Maletsky | Date: | Wed, 30 Aug 2000 09:05:26 +0000 |
| Subject: | FW: [PHP] $DOCUMENT_ROOT -- didn't work from a class.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14351@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: Maxim Maletsky
Sent: Wednesday, August 30, 2000 6:05 PM
To: 'Brian Clark'
Subject: RE: [PHP] $DOCUMENT_ROOT -- didn't work from a class..
You should return it there as
$this->docRoot
not
$docRoot
Cheers...
-----Original Message-----
From: Brian Clark [mailto:brianj@ais.ais-gwd.com]
Sent: Wednesday, August 30, 2000 5:55 PM
To: php-general@lists.php.net
Cc: Maxim Maletsky
Subject: RE: [PHP] $DOCUMENT_ROOT -- didn't work from a class..
Maxim Maletsky wrote:
>I think I fixed my own problem:
>
>i tried getenv($DOCUMENT_ROOT)
>
>and it worked,
>Thanks to anyone who tried to solve it or just thought 'bout it.
>
>now, just for my own education, why did it happened?
>was there a reason for it?
>was there anything else to do?
>
>Thank you ALL!
Now, what I want to know is why this works:
<?php
class Foo
{
function Bar()
{
return $GLOBALS['DOCUMENT_ROOT'];
}
}
$obj = new Foo;
print $obj->Bar();
?>
But this doesn't:
<?php
class Foo
{
var $docRoot = $GLOBALS['DOCUMENT_ROOT'];
function Bar()
{
return $docRoot;
}
}
$obj = new Foo;
print $obj->Bar();
?>
Brian