<?
$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>';
?>
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073