If you set a variable, either new or existing, the corresponding $_SERVER variable is not changed, and you will have to change it as well.
欢迎各位兄弟 发布技术文章
这里的技术是共享的
apache_setenv — 设置 Apache 子进程环境变量
$variable
, string $value
[, bool $walk_to_top
= false ] )apache_setenv() 设置由variable
指定的 Apache 环境变量值。
variable
将被设置的环境变量。
value
新 variable
值。
walk_to_top
是否将所设置的顶层变量应用到所有 Apache 层。
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
Example #1 使用 apache_setenv() 设置一个 Apache 环境变量
<?php
apache_setenv("EXAMPLE_VAR", "Example Value");
?>
If you set a variable, either new or existing, the corresponding $_SERVER variable is not changed, and you will have to change it as well.
If you are using mod_gzip or mod_deflate to compress HTML output, you're not able to send partial file to the browser....
To disable mod_deflate in PHP (if needed), you can tell Apache with this :
apache_setenv('no-gzip', '1');
When you need to set the QUERY_STRING variable into a page included with the "virtual" function do this:
virtual ("some_page.shtml?$QUERY_STRING");
apache_setenv does not work for this case.
When you want to set variables to pass to Server Side Includes (.shtml) included in PHP scripts, use this.
来自 http://www.php.net/manual/zh/function.apache-setenv.php