$_ENV["QUERY_STRING"]="ac="+$_COOKIE["ac"];
$_ENV["REQUEST_METHOD"]="GET";$ts = getenv("QUERY_STRING");
echo $ts;
$ip = getenv("REMOTE_ADDR");
echo $ip;可以看到,行不通。
你的env可以使用putenv来设置。
asp和php有很多不同,建议你去熟悉php的写法。
$_ENV["REQUEST_METHOD"]="GET";$ts = getenv("QUERY_STRING");
echo $ts;
$ip = getenv("REMOTE_ADDR");
echo $ip;可以看到,行不通。
你的env可以使用putenv来设置。
asp和php有很多不同,建议你去熟悉php的写法。
$_SERVER["REQUEST_METHOD"]="this is a test";$ts = $_ENV["QUERY_STRING"];
echo $ts;
$ip = $_SERVER["REQUEST_METHOD"];
echo $ip;
Please be aware, that using putenv() does NOT effect the superglobal $_ENV[] variable. If you want to, set it seperately<?php
putenv('MYVAR=hello');
assert(getenv('MYVAR') == 'hello'); // passes
assert($_ENV['MYVAR'] == 'hello'); // fails!
putenv('MYVAR='); // unset, otherwise this will pass when run the next time
?>