这里有两个问题:
。
; This directive determines which super global arrays are registered when PHP
; starts up. If the register_globals directive is enabled, it also determines
; what order variables are populated into the global space. G,P,C,E & S are
; abbreviations for the following respective super globals: GET, POST, COOKIE,
; ENV and SERVER. There is a performance penalty paid for the registration of
; these arrays and because ENV is not as commonly used as the others, ENV is
; is not recommended on productions servers. You can still get access to
; the environment variables through getenv() should you need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
; http://php.net/variables-order
variables_order = "GPCS"
当我确定variables_order
至EGPCS
,$_ENV
已不复存在。
<2. 当您在上使用时,在_SERVER
时,而不是在_ENV
上填写,而I gotta说,在名称时,这是一种令人沮丧的混淆。 SetEnv
# .htaccess
SetEnv ENV dev
SetEnv BASE /ssl/
# php
var_dump($_SERVER[ ENV ], $_SERVER[ BASE ]);
// string dev (length=3)
// string /ssl/ (length=5)
<代码>getenv
功能将始终有效,不受PHP设定值_ENV的影响。 此外,似乎对这种情况不敏感,这可能是有益的。
var_dump(getenv( os ), getenv( env ));
// string Windows_NT (length=10)
// string dev (length=3)