Re: Global vars or Environment var on Class
| From: | Vivian Steller | Date: | Tue, 17 Feb 2004 09:57:59 +0000 |
| Subject: | Re: Global vars or Environment var on Class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177915@lists.php.net to get a copy of this message | ||
Turbo wrote:
> Hi....
>
> I cann't call Global vars or Environment var on Class.How to's i do to
> call it?
> I want to call variable same below.
>
> var $location
>
> ="http://".$HTTP_SERVER_VARS['HTTP_HOST'].$_SERVER['REQUEST_URI']."?"
$HTTP_SERVER_VARS['QUERY_STRING'];
>
>
> Thank you.
> Turbo.
i would try the following:
- check if it works with $GLOBLAS['_SERVER']['REQUEST_URI']..., but I think
your implementation should work then, too.
- so: if you don't necessarily need this var to be a real class var (with
the only disadvantage not seeing it when asking for
get_class_vars("Class")) then let the var set by the constructor:
<?php
class Foo {
var $location = "";
function Foo() {
$this->location = $GLOBLAS['_SERVER']['REQUEST_URI']
. ...;
}
}
?>
hope i could help.
vivi