putenv("MYVAR=1");---设定myvar环境变量
echo getenv("MYVAR");--取出
你直接
echo getenv("MYVAR");
之前没有设置。所以没有结果。

解决方案 »

  1.   

    putenv getenv是不是只有本页面才可以使用,那我直接用变量得了,为什么还要用putenv getenv阿,难道不能设置到系统的环境变量里边吗
      

  2.   

    bool putenv ( string setting )
    Adds setting to the server environment. The environment variable will only exist for the duration of the current request. At the end of the request the environment is restored to its original state. 
      

  3.   

    http://cn.php.net/manual/zh/function.putenv.php