<?
$array = array(
"remote_addr",
"document_root",
"gateway_interface",
"server_software",
"server_name",
"server_protocol",
"server_port",
"server_admin",
"server_signature",
"request_method",
"request_uri",
"path_info",
"path_translated",
"script_name",
"script_filename",
"query_string",
"remote_host",
"remote_addr",
"remote_user",
"remote_ident",
"content_type",
"content_length",
"http_accept",
"http_accept_charset",
"http_accept_language",
"http_encoding",
"http_user_agent",
"http_connection",
"http_host",
"http_referer",
"auth_type"
);
echo <center>;
echo <table border="1" cellspacing="0" cellpadding="0">;
echo <caption>cgi environment variables</caption>;
echo <tr><th>name<th>value</tr>;
$count = count($array);
for($i=0;$i<$count;$i++){
$value = getenv($array[$i]);
if($value){
echo "<tr><td>$array[$i]<td>" . $value . "</tr>";
}
//下面的语句也可以哦
// if(isset($$array[$i])){
// echo "<tr><td>$array[$i]<td>" . $$array[$i] . "</tr>";
// }
}
echo </table>;
echo </center>;
?>